Compartir a través de


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 ();
}
/** @property */
public RecognitionConfidence get_Confidence ()
public function get Confidence () : RecognitionConfidence
Not applicable.

Property Value

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.

Example

This C# example reports gesture information in a status bar and displays the hot point coordinates in the status bar.

using System;
using System.Drawing;
using System.Windows.Forms;
using Microsoft.Ink;

public class CSGestureForm : System.Windows.Forms.Form
{
    private System.Windows.Forms.StatusBar theGestureStatusBar;
    private InkCollector theInkCollector;
    private Point theHotPoint;

    public CSGestureForm()
    {
        // Initialize the form with a status bar at the bottom.
        theGestureStatusBar = new System.Windows.Forms.StatusBar();
        SuspendLayout();
        theGestureStatusBar.Location = new System.Drawing.Point(0, 244);
        theGestureStatusBar.Size = new System.Drawing.Size(350, 22);
        theGestureStatusBar.Text = "";
        ClientSize = new System.Drawing.Size(350, 266);
        Controls.AddRange(new System.Windows.Forms.Control[] {this. theGestureStatusBar});
        Text = "Gesture Test Application";
        this.BackColor = Color.LightGray;
        ResumeLayout(false);

        // Give the hot spot an initial value.
        theHotSpot = new Point(-1, -1);

        // Initialize the InkCollector object.
        theInkCollector = new InkCollector(Handle);
        theInkCollector.CollectionMode = CollectionMode.GestureOnly;
        theInkCollector.SetGestureStatus(ApplicationGesture.Check, true);
        theInkCollector.Gesture += new InkCollectorGestureEventHandler(Gesture_Event);
        theInkCollector.Enabled = true;
    }

    static void Main()
    {
        Application.Run(new CSGestureForm());
    }

    private void Gesture_Event(object sender, InkCollectorGestureEventArgs e)
    {
        // Only get information on the first gesture returned.
        Gesture theGesture = e.Gestures[0];
        // Save the hot point information for painting.
        theHotPoint = theGesture.HotPoint;
        // Write the gesture type and confidence on the status bar.
        theGestureStatusBar.Text = theGesture.Id + "  " + theGesture.Confidence + 
            ";  HotPoint coordinates:  " + theHotPoint.ToString();
        Refresh();
    }
}

This Microsoft® Visual Basic® .NET example reports gesture information in a status bar and displays the hot point coordinates in the status bar.

Imports System.Drawing
Imports Microsoft.Ink
Public Class Form1
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "
'This contains the default form code, plus a status bar, StatusBar1.
#End Region

    Dim theInkCollector As InkCollector
    Friend WithEvents StatusBar1 As System.Windows.Forms.StatusBar
    Dim theHotPoint As System.Drawing.Point

    Private Sub Form1_Load(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles MyBase.Load
        theHotPoint = New Point(-1, -1)
        theInkCollector = New InkCollector(Handle)
        theInkCollector.CollectionMode = CollectionMode.GestureOnly
        theInkCollector.SetGestureStatus(ApplicationGesture.Check, True)
        AddHandler theInkCollector.Gesture, AddressOf Gesture_Event
        theInkCollector.Enabled = True
    End Sub

    Private Sub Gesture_Event( _
    ByVal sender As Object, _
    ByVal e As InkCollectorGestureEventArgs)
        'Only get information on the first gesture returned.
        Dim theGesture As Gesture = e.Gestures(0)
        'Save the hot point information for painting.
        theHotPoint = theGesture.HotPoint
        'Write the gesture type and confidence on the status bar.
        StatusBar1.Text = theGesture.Id.ToString() & _
            "  " & theGesture.Confidence.ToString() & _
            ";  HotPoint coordinates:  " + theHotPoint.ToString()
        Refresh()
    End Sub

    Private Sub InitializeComponent()
        Me.StatusBar1 = New System.Windows.Forms.StatusBar()
        Me.SuspendLayout()
        '
        'StatusBar1
        '
        Me.StatusBar1.Location = New System.Drawing.Point(0, 252)
        Me.StatusBar1.Name = "StatusBar1"
        Me.StatusBar1.Size = New System.Drawing.Size(350, 22)
        Me.StatusBar1.TabIndex = 0
        Me.StatusBar1.Text = "StatusBar1"
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 15)
        Me.ClientSize = New System.Drawing.Size(350, 260)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.StatusBar1})
        Me.Name = "Form1"
        Me.ResumeLayout(False)
    End Sub
End Class

Platforms

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

Gesture Class
Gesture Members
Microsoft.Ink Namespace
DrawingAttributes.ExtendedProperties
ExtendedProperties
Stroke.ExtendedProperties