Freigeben über


Recognizer Plug-ins

Recognizer Plug-ins

Overview of recognizer plug-ins.

A recognizer plug-in is an object that monitors the movement of the tablet pen for gestures, handwriting, or other objects.

System Gestures

The RealTimeStylus object recognizes system gestures. The RealTimeStylus object adds a SystemGestureData object to the Input queue in response to the data that finishes the gesture, such as a StylusUpData object for the Tap gesture.

The GestureRecognizer Object

The GestureRecognizer object implements the IStylusSyncPlugin and IStylusAsyncPlugin interfaces. The GestureRecognizer object recognizes application gestures. Internally, the GestureRecognizer object uses the Microsoft gesture recognizer to perform gesture recognition.

Note: An instance of the GestureRecognizer class can be added to one RealTimeStylus object only, and only once to one of the RealTimeStylus object's plug-in collections. If a GestureRecognizer object is added to more than one RealTimeStylus object or added more than once to the RealTimeStylus object's plug-in collections, then the GestureRecognizer object disables itself. For more information about the GestureRecognizer object, see the GestureRecognizer class topic.

The GestureRecognizer object is implemented as a Component Object Model (COM) wrapper, and you can not call its IStylusSyncPlugin or IStylusAsyncPlugin interface methods directly. For more information about COM implementation and the RealTimeStylus object, see Implementation Notes for the StylusInput APIs.

When the GestureRecognizer object recognizes a gesture, it adds custom stylus data to the Input queue in response to the StylusUpData object for the stroke. The CustomStylusData object's CustomDataId property is set to the GestureRecognitionDataGuid value, and the CustomStylusData object's Data property contains a GestureRecognitionData object.

By default, the GestureRecognizer object recognizes only single-stroke gestures; however, the GestureRecognizer object can be set to recognize multistroke gestures. For multistroke gestures, the CustomStylusData object is added to the Input queue in response to the StylusUpData object for the final stroke of the gesture. When recognizing multistroke gestures, you may receive notifications for overlapping sets of strokes. For example, the first and second strokes together may be recognized as one gesture, the second stroke by itself may be recognized as a gesture, and the second and third strokes together may be recognized as another gesture. For more information about multistroke gesture recognition, see the GestureRecognizer class and the MaxStrokeCount property.

If you are using the GestureRecognizer object for mutistroke gesture recognition, you may achieve optimal performance by using a cascaded RealTimeStylus model and attaching the GestureRecognizer object to the secondary RealTimeStylus object. For more information about the cascading RealTimeStylus model, see The Cascaded RealTimeStylus Model

Custom Gesture Recognition

You can create a custom recognizer plug-in that recognizes handwriting, gestures, or other objects by: