Freigeben über


GestureRecognizer.EnableGestures Method

GestureRecognizer.EnableGestures Method

Sets which ApplicationGestures will result in the GestureRecognizer adding GestureRecognitionData into the input queue.

Definition

Visual Basic .NET Public Sub EnableGestures( _
ByVal gestures() As ApplicationGesture _
)
C# public void EnableGestures(
ApplicationGesture[] gestures
);
Managed C++ public: void EnableGestures(
ApplicationGesture *gestures __gc[]
);

Parameters

> > >
gestures Microsoft.Ink.ApplicationGesture[]. The ApplicationGestures that the GestureRecognizer will respond to.

AllGestures0 Recognizes all application-specific gestures.
NoGesture61440 Recognizes no application-specific gestures.
Scratchout61441 Erases content. This gesture requires at least three strokes in a back-and-forth direction.
Triangle61442 Inserts input. The triangle must be drawn in a single stroke, without lifting the pen.
Square61443 Marks an action item. The square can be drawn in one or two strokes. In one stroke, draw the entire square without lifting the pen. In two strokes, draw three sides of the square and use another stroke to draw the remaining side. Do not use more than two strokes to draw the square.
Star61444 Marks an action item. The star must have exactly five points and be drawn in a single stroke without lifting the pen.
Check61445 Denotes a check-off. The upward stroke must be twice as long as the smaller downward stroke.
Curlicue61456 Cuts a word. Start the curlicue on the word you intend to cut.
DoubleCurlicue61457 Copies a word. Start the double-curlicue on the word you intend to copy.
Circle61472 Has no suggested semantic behavior or action. The circle must be drawn in a single stroke without lifting the pen.
DoubleCircle61473 Pastes a selection. The two circles must overlap each other and be drawn in a single stroke without lifting the pen.
SemiCircleLeft61480 Undoes an action. The semicircle must be drawn from left to right. The two ends of the semicircle should be as horizontally even as possible .
SemiCircleRight61481 Redoes an action. The semicircle must be drawn from right to left. The two ends of the semicircle should be as horizontally even as possible.
ChevronUp61488 Has no suggested semantic behavior or action. Both sides of the chevron must be drawn as equal as possible. The angle must be sharp and end in a point.
ChevronDown61489 Has no suggested semantic behavior or action. Both sides of the chevron must be drawn as equal as possible. The angle must be sharp and end in a point.
ChevronLeft61490 Has no suggested semantic behavior or action. Both sides of the chevron must be drawn as equal as possible. The angle must be sharp and end in a point.
ChevronRight61491 Has no suggested semantic behavior or action. Both sides of the chevron must be drawn as equal as possible. The angle must be sharp and end in a point.
ArrowUp61496 Has no suggested semantic behavior or action. The arrow can be drawn in single stroke or in two strokes where one stroke is the line and the other is the arrow head. Do not use more than two strokes to draw the arrow.
ArrowDown61497 Has no suggested semantic behavior or action. The arrow can be drawn in a single stroke or in two strokes where one stroke is the line and the other is the arrow head. Do not use more than two strokes to draw the arrow.
ArrowLeft61498 Has no suggested semantic behavior or action. The arrow can be drawn in a single stroke or in two strokes where one stroke is the line and the other is the arrow head. Do not use more than two strokes to draw the arrow.
ArrowRight61499 Has no suggested semantic behavior or action. The arrow can be drawn in a single stroke or in two strokes where one stroke is the line and the other is the arrow head. Do not use more than two strokes to draw the arrow.
Up61528 Has no suggested semantic behavior or action. This gesture must be drawn as a single fast flick in the upward direction.
Down61529 Has no suggested semantic behavior or action. This gesture must be drawn as a single fast flick in the downward direction.
Left61530 Specifies a backspace. This gesture must be drawn as a single fast flick to the left.
Right61531 Signifies a space. This gesture must be drawn as a single fast flick to the right.
UpDown61536 Undoes an action. This gesture must be drawn in a single stroke starting with the up stroke. The two strokes must be as close to each other as possible.
DownUp61537 Has no suggested semantic behavior or action. This gesture must be drawn in a single stroke starting with the down stroke. The two strokes must be as close to each other as possible.
LeftRight61538 Cuts a selection. This gesture must be drawn in a single stroke starting with the left stroke. The two strokes must be as close to each other as possible.
RightLeft61539 Copies a selection. This gesture must be drawn in a single stroke starting with the right stroke. The two strokes must be as close to each other as possible.
UpLeftLong61540 Decreases the indent. This gesture must be drawn in a single stroke starting with the up stroke. The left stroke must be about twice as long as the up stroke, and the two strokes must be at a right angle.
UpRightLong61541 Signifies pressing a TAB key. This gesture must be drawn in a single stroke starting with the up stroke. The right stroke must be about twice as long as the up stroke, and the two strokes must be at a right angle.
DownLeftLong61542 Signifies pressing an ENTER key. This gesture must be drawn in a single stroke starting with the down stroke. The left stroke is about twice as long as the up stroke, and the two strokes must be at a right angle.
DownRightLong61543 Signifies pressing the spacebar. This gesture must be drawn in a single stroke starting with the down stroke. The right stroke must be about twice as long as the up stroke, and the two strokes must be at a right angle.
UpLeft61544 Has no suggested semantic behavior or action. This gesture must be drawn in a single stroke starting with the up stroke. The two sides must be as equal in length as possible and at a right angle.
UpRight61545 Has no suggested semantic behavior or action. This gesture must be drawn in a single stroke starting with the up stroke. The two sides must be as equal in length as possible and at a right angle.
DownLeft61546 Has no suggested semantic behavior or action. This gesture must be drawn in a single stroke starting with the down stroke. The two sides must be as equal in length as possible and at a right angle.
DownRight61547 Has no suggested semantic behavior or action. This gesture must be drawn in a single stroke starting with the down stroke. The two sides must be as equal in length as possible and at a right angle.
LeftUp61548 Has no suggested semantic behavior or action. This gesture must be drawn in a single stroke starting with the left stroke. The two sides must be as equal in length as possible and at a right angle.
LeftDown61549 Has no suggested semantic behavior or action. This gesture must be drawn in a single stroke starting with the left stroke. The two sides are as equal in length as possible and at a right angle.
RightUp61550 Signifies an Input Method Editor (IME) convert. This gesture must be drawn in a single stroke starting with the right stroke. The two sides must be as equal in length as possible and at a right angle.
RightDown61551 Has no suggested semantic behavior or action. This gesture must be drawn in a single stroke starting with the right stroke. The two sides must be as equal in length as possible and at a right angle.
Exclamation61604 Has no suggested semantic behavior or action. The line must be drawn first and then the dot drawn quickly and as close to the line as possible.
Tap61680 Signifies a mouse click. For the least amount of slippage, the tap must be made quickly.
DoubleTap61681 Signifies a mouse double-click. The two taps must be made quickly to result in the least amount of slippage and the least duration between taps. In addition, the taps must be as close to each other as possible.

Exceptions

COMException Leave Site:
ObjectDisposedException Leave Site: The GestureRecognizer object is disposed.

Remarks

An ArgumentException Leave Site will be thrown if you attempt to enable AllGestures in conjunction with any other gestures.

Examples

This Microsoft® Visual C#® .NET example is a snippet from a form's Load Leave Site event handler, which creates a GestureRecognizer, DynamicRenderer, and two RealTimeStylus objects, attaches the objects in a cascaded RealTimeStylus model, and enables dynamic rendering, gesture recognition, and tablet pen data collection through the RealTimeStylus. The GestureRecognizer object is set to recognize single-stroke gestures and to only recognize the Right, ChevronRight, and ArrowRight application gestures. The primary RealTimeStylus object's WindowInputRectangle property is explicitly set to use the entire control to which the RealTimeStylus object is attached. The form itself implements the IStylusAsyncPlugin interface and is attached to the RealTimeStylus object.

[C#]using Microsoft.Ink;
using Microsoft.StylusInput;
using Microsoft.StylusInput.PluginData;

// ...

// The panel where the tablet pen data is collected.
private System.Windows.Forms.Panel thePanel;

// Declare the RealTimeStylus objects, the GestureRecognizer plugin,
// and the DynamicRenderer plug-in.
private Microsoft.StylusInput.RealTimeStylus thePrimaryRealTimeStylus = null;
private Microsoft.StylusInput.RealTimeStylus theSecondaryRealTimeStylus = null;
private Microsoft.StylusInput.GestureRecognizer theGestureRecognizer = null;
private Microsoft.StylusInput.DynamicRenderer theDynamicRenderer = null;

// The form's Load event handler.
private void theForm_Load(object sender, System.EventArgs e)
{
    // ...

    // Create a DynamicRenderer attached to the drawing area ,
    // and enable dynamic rendering.
    this.theDynamicRenderer = new DynamicRenderer(this.thePanel);
    this.theDynamicRenderer.Enabled = true;

    // Create a GestureRecognizer, and set it to recognize single-stroke gestures.
    this.theGestureRecognizer = new GestureRecognizer();
    this.theGestureRecognizer.MaxStrokeCount = 1;

    // Allow gesture recognition for specific gestures.
    this.theGestureRecognizer.EnableGestures( new ApplicationGesture[]
        {
            ApplicationGesture.Right,
            ApplicationGesture.ChevronRight,
            ApplicationGesture.ArrowRight
        } );

    // Enable gesture recognition.
    this.theGestureRecognizer.Enabled = true;

    // Create the primary and secondary RealTimeStylus objects.
    this.thePrimaryRealTimeStylus = new RealTimeStylus(this.thePanel);
    this.theSecondaryRealTimeStylus = new RealTimeStylus();

    // Add the secondary RealTimeStylus to the primary's asynchronous plug-in collection.
    this.thePrimaryRealTimeStylus.AsyncPluginCollection.Add(
        this.theSecondaryRealTimeStylus);

    // Add the dynamic renderer to the primary's synchronous plug-in collection.
    this.thePrimaryRealTimeStylus.SyncPluginCollection.Add(this.theDynamicRenderer);

    // Add the gesture recognizer to the secondary's synchronous plug-in collection.
    this.theSecondaryRealTimeStylus.SyncPluginCollection.Add(this.theGestureRecognizer);

    // Add the form to the secondary's asynchronous plug-in colleciton.
    this.theSecondaryRealTimeStylus.AsyncPluginCollection.Add(this);

    // Set the input rectangle to the entire panel for the RealTimeStylus.
    this.thePrimaryRealTimeStylus.WindowInputRectangle = new Rectangle(0,0,0,0);

    // Enable the RealTimeStylus, which allows notifications to flow to the plug-ins.
    this.thePrimaryRealTimeStylus.Enabled = true;

    // ...
}