Compartilhar via


Ink-Collector Plug-ins

Ink-Collector Plug-ins

Overview of ink-collector plug-ins.

The RealTimeStylus object does not inherently collect ink. To use the RealTimeStylus to collect ink, create an ink-collector plug-in.

The following is a minimal scenario for using the RealTimeStylus object on a form that collects ink.

  1. Create a form that implements the IStylusAsyncPlugin interface.
  2. Create a RealTimeStylus object, and attach it to a control on the form.
  3. Set interest in the StylusDown, Packets, and Stylus notifications in the form's DataInterest property.
  4. In the form's IStylusAsyncPlugin.StylusDown, IStylusAsyncPlugin.Packets, and IStylusAsyncPlugin.StylusUp methods, add code to handle the stylus down, packets, and stylus up notifications that are sent from the form's RealTimeStylus object.

For a sample of such an application, see the RealTimeStylus Ink Collection Sample sample.

Note: When a DisplaySettingsChanged Leave Site event occurs, call the ModifyDrawingAttributes method of the collected strokes in a DisplaySettingsChanged Leave Site event handler to recalculate the Width and Height properties. This is necessary to account for possible dots per inch (dpi) changes that result from the DisplaySettingsChanged Leave Site event.

Ink Collection and Recognizers

Neither ink analysis nor handwriting recognition is a function of the RealTimeStylus object. As the ink-collector plug-in collects ink—or as you want to recognize the ink—you can copy the ink to a RecognizerContext or Divider object. For more information about recognition and ink analysis, see About Recognition or About Ink Analysis with the Divider Object.

Static Rendering

To render ink as it is being collected, attach a DynamicRenderer object to the RealTimeStylus object. To render ink after it has been collected, use a Renderer object to draw the strokes to the appropriate Graphics Leave Site object. For more information about the DynamicRenderer object, see Dynamic-Renderer Plug-ins. For a sample of both static and dynamic rendering, see RealTimeStylus Ink Collection Sample.