Friday, September 26, 2003

this was about what the pen does to the collection and overlay, so back to that, Modes , modes and more modes, will talk about modes when i can,
11 methods and 14 properties of the PenInputPanel provide the rest of all the capability that is available to program the panel . Personally i think the panel should be a really last solution. That is if there is nothing else you can do to re design your app so that it can take adavantage of ink and related technologies.

Though am sure there are genuine time when firing up that component on a tablet makes sense like during the login secure desktop session.
and also there is what the Pen does to the Overlay or Collector. Remember that the collector and overlay are the main ways that the pen acutally lays out ink to Windows, or put another way all the ink flows to Windows through this two components -yes the input panel also picks up ink--

yes the Input Panel a hangover from Windows qwerty computing
The PenInputPanel has 3 constructors, a no args constructor and of course one that attaches to a Window and another that attaches to a control
public PenInputPanel();
public PenInputPanel(IntPtr AttachHandle);
public PenInputPanel(System.Windows.Forms.Control AttachControl);

also has a panel type enum that stores what the input panel is at a specific time. They are in order Default = last input panel type used , Inactive = just what it says, Handwriting = defaults to handwriting (current input language is used), Keyboard = like it says, the keyboard.

4 simple events are handy for doing all kinds of things from checking input failures too checking if the panel is visible

InkCollector and InkOverlay objects keep a set of ink rendering properties around named default drawing attributes. A kind of ink state. This properties are the what the ink that this components are able to produce at any given instance -- The State of the Ink so to speak

These are characteristics such as color, thickness, and pen tip style that are part of a class named Drawing­Attributes. InkCollector/Overlay have a property of type DrawingAttributes to maintain the default drawing attributes, named DefaultDrawingAttributes.

snippets galore: changing the color of ink using the standard color dialog

// Create and display the common color dialog, using the current ink color as its initial selection
ColorDialog dlgColor = new ColorDialog();
dlgColor.Color = inkOverlay.DefaultDrawingAttributes.Color;
if (dlgColor.ShowDialog(this) == DialogResult.OK)
{
// Set the current ink color to the selection chosen in
// the dialog
inkOverlay.DefaultDrawingAttributes.Color = dlgColor.Color;
}

snippet does the following things -

  • creates a ColorDialog,
  • shows the dialog and
  • sets the inkOverlay.DefaultDrawingAttributes.Color to selected dlgColor.Color;


Most of my snippets will use InkOverlay