InkCollectorGestureEventHandler 委托

表示处理 InkCollector 对象的 Gesture 事件的方法。

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

语法

声明
Public Delegate Sub InkCollectorGestureEventHandler ( _
    sender As Object, _
    e As InkCollectorGestureEventArgs _
)
用法
Dim instance As New InkCollectorGestureEventHandler(AddressOf HandlerMethod)
public delegate void InkCollectorGestureEventHandler(
    Object sender,
    InkCollectorGestureEventArgs e
)
public delegate void InkCollectorGestureEventHandler(
    Object^ sender, 
    InkCollectorGestureEventArgs^ e
)
/** @delegate */
public delegate void InkCollectorGestureEventHandler(
    Object sender,
    InkCollectorGestureEventArgs e
)
JScript 不支持委托。

参数

备注

当用户用笔执行应用程序笔势识别器所识别的预定义应用程序笔势 时,将发生 Gesture 事件。

创建 InkCollectorGestureEventHandler 委托时,需要标识将处理该事件的方法。若要将该事件与事件处理程序关联,请将该委托的一个实例添加到事件中。除非移除了该委托,否则每当发生该事件时就会调用此事件处理程序。

如果 CollectionMode 属性设置为 GestureOnly,则从用户添加笔势到 Gesture 事件发生之间的超时是一个固定值,无法以编程方式更改。在 InkAndGesture 模式中,笔势识别的速度更快。

若要在 InkAndGesture 模式中禁止收集墨迹:

若要在笔势处理时禁止墨迹流,请将 DynamicRendering 属性设置为 false。

备注

若要识别笔势,必须使用可以收集墨迹的对象或控件。

备注

InkCollector 对象、InkOverlay 对象和 InkPicture 控件使用 InkCollectorGestureEventHandler 委托来添加 Gesture 事件处理程序。

示例

本示例中的事件处理程序在状态栏标签 statusLabelAppGesture 上显示应用程序笔势信息。

Private Sub Event_OnApplicationGesture(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
    Dim G As Gesture = e.Gestures(0)

    ' we will use the gesture if it has confidence of strong or intermediate

    If G.Confidence = RecognitionConfidence.Intermediate Or _
    G.Confidence = RecognitionConfidence.Strong Then

        Select Case G.Id
            Case ApplicationGesture.Left
                statusLabelAppGesture.Text = "Left"
            Case ApplicationGesture.Right
                statusLabelAppGesture.Text = "Right"
            Case ApplicationGesture.Up
                statusLabelAppGesture.Text = "Up"
            Case ApplicationGesture.Down
                statusLabelAppGesture.Text = "Down"
        End Select

    End If
End Sub
void Event_OnApplicationGesture(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
    Gesture G = e.Gestures[0];

    // we will use the gesture if it has confidence of strong or intermediate

    if (G.Confidence == RecognitionConfidence.Intermediate ||
        G.Confidence == RecognitionConfidence.Strong)
    {

        switch (G.Id)
        {
            case ApplicationGesture.Left:
                statusLabelAppGesture.Text = "Left";
                break;
            case ApplicationGesture.Right:
                statusLabelAppGesture.Text = "Right";
                break;
            case ApplicationGesture.Up:
                statusLabelAppGesture.Text = "Up";
                break;
            case ApplicationGesture.Down:
                statusLabelAppGesture.Text = "Down";
                break;
        }
    }

}

只有已设置为关注的应用程序笔势才会激发此事件。在此示例中,InkCollector 对象 mInkCollector 设置对 ApplicationGesture 枚举的四个笔势的关注。

' set InkCollector interest in the Left, Right, Up, Down gestures
mInkCollector.SetGestureStatus(ApplicationGesture.Left, True)
mInkCollector.SetGestureStatus(ApplicationGesture.Right, True)
mInkCollector.SetGestureStatus(ApplicationGesture.Up, True)
mInkCollector.SetGestureStatus(ApplicationGesture.Down, True)
// set InkCollector interest in the Left, Right, Up, Down gestures
mInkCollector.SetGestureStatus(ApplicationGesture.Left, true);
mInkCollector.SetGestureStatus(ApplicationGesture.Right, true);
mInkCollector.SetGestureStatus(ApplicationGesture.Up, true);
mInkCollector.SetGestureStatus(ApplicationGesture.Down, true);

平台

Windows Vista

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

版本信息

.NET Framework

受以下版本支持:3.0

另请参见

参考

Microsoft.Ink 命名空间

ApplicationGesture

InkCollector.SetGestureStatus