Best Practices (Tablet PC)

There are a few guidelines to keep in mind when using the PenInputPanel object.

Prefer InkEdit Control

InkEdit is the preferred control to which to attach the PenInputPanel object. The InkEdit control provides support for the Text Services Framework (TSF).

Disable Ink Mode on InkEdit Controls

When attached to an InkEdit control, set the InkMode property of the InkEdit control to the InkMode value. If the InkMode property is not set to the InkMode value, the InkEdit control interprets the first tap as a stroke, passes it to the recognizer, and inserts the text in the InkEdit control. Since you already have a PenInputPanel object attached to accept ink input, there is no need to have the InkEdit control also enabled for ink input.

Using Windowless Controls

When a PenInputPanel object is attached to a parent window that contains more than one windowless control, the PenInputPanel object does not know how to track the caret as focus moves among windowless children. Handwriting input can be sent to the wrong child when focus moves from one windowless control to another while input is pending.

To use the PenInputPanel object in a windowless environment, the following technique can be used:

  1. Instantiate a TextBox control and position it over the windowless control.
  2. Attach the PenInputPanel object to the new text box control.
  3. Let the text box control collect the recognized text from the PenInputPanel object.
  4. When focus changes away from the text box control, call the CommitPendingInput method of the PenInputPanel object.
  5. Copy the recognized text from the text box control to the windowless child.
  6. Detach the PenInputPanel object by setting its AttachedEditControl (managed code only) property or AttachedEditWindow property to null.
  7. Destroy the text box control.

PenInputPanel Class

Microsoft.Ink.PenInputPanel

Text Services Framework