Share via


Gesture.Id Property

Gets the value of the application gesture.

Namespace:  Microsoft.Ink
Assembly:  Microsoft.Ink (in Microsoft.Ink.dll)

Syntax

'Declaration
Public ReadOnly Property Id As ApplicationGesture
'Usage
Dim instance As Gesture 
Dim value As ApplicationGesture 

value = instance.Id
public ApplicationGesture Id { get; }
public:
property ApplicationGesture Id {
    ApplicationGesture get ();
}
public function get Id () : ApplicationGesture

Property Value

Type: Microsoft.Ink.ApplicationGesture
The value of the application gesture.

Remarks

Note

A Gesture object's identifier is constant over time, meaning that it never changes.

Because each application gesture exists as a value in the ApplicationGesture enumeration, the value serves as the ID of that gesture.

Examples

In this example, an event handler fires when an application gesture is recognized. Only ApplicationGesture types that have been specifically requested by the application (by calling the SetGestureStatus method) will fire the event. In examining the first Gesture object passed to the event handler, if the Confidence property is set to strong confidence for a Check gesture, a small circle is drawn around the coordinates represented by the HotPoint property.

' event handler for InkOverlay.Gesture event 
Private Sub mInkObject_Gesture(ByVal sender As Object, ByVal e As InkCollectorGestureEventArgs)
    ' There might be more than one gesture passed in InkCollectorGestureEventArgs 
    ' The gestures are arranged in order of confidence from most to least 
    ' This event handler is only concerned with the first (most confident) gesture 
    ' and only if the first gesture has RecognitionConfidence.Strong 
    Dim G As Gesture = e.Gestures(0)

    ' if this is ApplicationGesture.Check of RecognitionConfidence.Strong confidence 
    If ApplicationGesture.Check = G.Id And RecognitionConfidence.Strong = G.Confidence Then 
        Dim mInkOverlay As InkOverlay = DirectCast(sender, InkOverlay)
        ' assuming here that InkOverlay.AttachedControl property is set. 
        ' This can be set with the .ctor InkOverlay(Control C) or the 
        ' InkOverlay.AttachedControl property can be set later. 
        Using GR As Graphics = mInkOverlay.AttachedControl.CreateGraphics()
            ' get the hot point 
            Dim hotPoint As Point = G.HotPoint
            ' convert to pixel coordinates
            mInkOverlay.Renderer.InkSpaceToPixel(GR, hotPoint)
            ' draw a small circle
            GR.DrawEllipse(Pens.Orange, hotPoint.X - 6, hotPoint.Y - 6, 12, 12)
            ' cancel the event. This prevents the gesture from disappearing 
            ' and lets you see the small circle and the gesture together
            e.Cancel = True 
        End Using 
    End If 
End Sub
// event handler for InkOverlay.Gesture event 
private void mInkObject_Gesture(object sender, InkCollectorGestureEventArgs e)
{
    // There might be more than one gesture passed in InkCollectorGestureEventArgs 
    // The gestures are arranged in order of confidence from most to least 
    // This event handler is only concerned with the first (most confident) gesture 
    // and only if the first gesture has RecognitionConfidence.Strong
    Gesture G = e.Gestures[0];

    // if this is ApplicationGesture.Check of RecognitionConfidence.Strong confidence 
    if (ApplicationGesture.Check == G.Id && RecognitionConfidence.Strong == G.Confidence)
    {
        InkOverlay mInkOverlay = (InkOverlay)sender;
        // assuming here that InkOverlay.AttachedControl property is set. 
        // This can be set with the .ctor InkOverlay(Control C) or the 
        // InkOverlay.AttachedControl property can be set later. 
        using (Graphics GR = mInkOverlay.AttachedControl.CreateGraphics())
        {
            // get the hot point
            Point hotPoint = G.HotPoint;
            // convert to pixel coordinates
            mInkOverlay.Renderer.InkSpaceToPixel(GR, ref hotPoint);
            // draw a small circle
            GR.DrawEllipse(Pens.Orange, hotPoint.X - 6, hotPoint.Y - 6, 12, 12);
            // cancel the event. This prevents the gesture from disappearing 
            // and lets you see the small circle and the gesture together
            e.Cancel = true;
        }
    }
}

Platforms

Windows 7, Windows Vista, Windows Server 2008 R2, Windows Server 2008

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

Gesture Class

Gesture Members

Microsoft.Ink Namespace

ApplicationGesture