Gesture.Id 属性

获取应用程序笔势 的值。

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

语法

声明
Public ReadOnly Property Id As ApplicationGesture
用法
Dim instance As Gesture
Dim value As ApplicationGesture

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

属性值

类型:Microsoft.Ink.ApplicationGesture
应用程序笔势的值。

备注

备注

Gesture 对象的标识符不随时间而改变,这意味着它永远不会更改。

因为每个应用程序笔势 都作为 ApplicationGesture 枚举中的值存在,因此该值被用作笔势的 ID。

示例

在此示例中,识别应用程序笔势 时将激发一个事件处理程序。只有由应用程序通过调用 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 命名空间

ApplicationGesture