Share via


Gesture.Confidence 属性

获取识别器 对某笔势 的识别所具有的置信级别(高、中或低)。

命名空间:  Microsoft.Ink
程序集:  Microsoft.Ink(在 Microsoft.Ink.dll 中)

语法

声明
Public ReadOnly Property Confidence As RecognitionConfidence
用法
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

属性值

类型:Microsoft.Ink.RecognitionConfidence
识别器对某笔势的识别所具有的置信级别(高、中或低)。

备注

备注

置信评估对当前版本 Windows XP Tablet PC Edition 中的所有笔势识别器都可用。

有关可返回的置信值的列表,请参见 RecognitionConfidence 枚举类型。

示例

在此示例中,识别应用程序笔势 时将激发一个事件处理程序。只有由应用程序通过调用 SetGestureStatus 方法专门请求的 ApplicationGesture 类型才会激发该事件。在检查传递给事件处理程序的第一个 Gesture 对象时,如果 Confidence 属性对某个 Check 笔势设置高置信度,则在由 HotPoint 属性表示的坐标周围绘制一个小圆圈。

' 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;
        }
    }
}

平台

Windows Vista

.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求

版本信息

.NET Framework

受以下版本支持:3.0

另请参见

参考

Gesture 类

Gesture 成员

Microsoft.Ink 命名空间

DrawingAttributes.ExtendedProperties

ExtendedProperties

Stroke.ExtendedProperties