Gesture.Confidence Property

Gets the level of confidence (strong, intermediate, or poor) that a recognizer has in the recognition of a gesture.

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

Syntax

'Declaration
Public ReadOnly Property Confidence As RecognitionConfidence
'Usage
Dim instance As Gesture 
Dim value As RecognitionConfidence 

value = instance.Confidence
public RecognitionConfidence Confidence { get; }
public:
property RecognitionConfidence Confidence {
    RecognitionConfidence get ();
}
public function get Confidence () : RecognitionConfidence

Property Value

Type: Microsoft.Ink.RecognitionConfidence
The level of confidence (strong, intermediate, or poor) that a recognizer has in the recognition of a gesture.

Remarks

Note

Confidence evaluation is available for all gesture recognizers in the current release of Windows XP Tablet PC Edition.

For a list of confidence values that may be returned, see the RecognitionConfidence enumeration type.

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

DrawingAttributes.ExtendedProperties

ExtendedProperties

Stroke.ExtendedProperties