共用方式為


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 委派 (Delegate) 時,您會識別處理事件的方法。若要使事件與您的事件處理常式產生關聯,請將委派的執行個體 (Instance) 加入至事件。除非您移除委派,否則每當事件發生時就會呼叫事件處理常式。

CollectionMode 屬性設定為 GestureOnly 時,從使用者加入筆勢到發生 Gesture 事件之間的逾時值是固定的,不能透過程式設計方式進行更改。InkAndGesture 模式的筆勢辨識速度較快。

如果不想在 InkAndGesture 模式下收集筆墨:

若要避免處理筆勢時筆墨發生流動,請將 DynamicRendering 屬性設定為 false。

ms573448.alert_note(zh-tw,VS.90).gif注意事項:

若要辨識筆勢,您必須使用可以收集「筆墨」的物件或控制項。

ms573448.alert_note(zh-tw,VS.90).gif注意事項:

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 列舉型別 (Enumeration) 的四個筆勢感興趣。

' 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