共用方式為


Gesture.Confidence Property

Gesture.Confidence Property

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

Definition

Visual Basic .NET Public ReadOnly Property Confidence As RecognitionConfidence
C# public RecognitionConfidence Confidence { get; }
Managed C++ public: __property RecognitionConfidence* get_Confidence();

Property Value

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

This property is read-only. This property has no default value.

Strong0 Indicates strong confidence in the result or alternate.
Intermediate1 Indicates intermediate confidence in the result or alternate.
Poor2 Indicates poor confidence in the result or alternate.

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

[C#]

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();
    }
}
                

[VB.NET]

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
                

See Also