次の方法で共有


InkOverlay.Gesture イベント

アプリケーション ジェスチャが認識されたときに発生します。

名前空間 :  Microsoft.Ink
アセンブリ :  Microsoft.Ink (Microsoft.Ink.dll 内)

構文

'宣言
Public Event Gesture As InkCollectorGestureEventHandler
'使用
Dim instance As InkOverlay
Dim handler As InkCollectorGestureEventHandler

AddHandler instance.Gesture, handler
public event InkCollectorGestureEventHandler Gesture
public:
 event InkCollectorGestureEventHandler^ Gesture {
    void add (InkCollectorGestureEventHandler^ value);
    void remove (InkCollectorGestureEventHandler^ value);
}
/** @event */
public void add_Gesture (InkCollectorGestureEventHandler value)
/** @event */
public void remove_Gesture (InkCollectorGestureEventHandler value)
JScript では、イベントは使用できません。

解説

このイベントが発生するためには、InkOverlay オブジェクトが一連のアプリケーション ジェスチャ内に対象を持つ必要があります。一連のジェスチャ内に InkOverlay オブジェクトの対象を設定するには、SetGestureStatus メソッドを呼び出します。

特定のアプリケーション ジェスチャについては、ApplicationGesture 列挙型を参照してください。アプリケーション ジェスチャの詳細については、「Command Input on the Tablet PC」および「Using Gestures」を参照してください。

イベント ハンドラは、このイベントについてのデータを格納している InkCollectorGestureEventArgs 型の引数を受け取ります。

InkCollectorGestureEventHandler デリゲートを作成する場合は、イベントを処理するメソッドを指定します。イベントをイベント ハンドラに関連付けるには、デリゲートのインスタンスをイベントに追加します。デリゲートを削除しない限り、そのイベントが発生すると常にイベント ハンドラが呼び出されます。

InkOverlay.CollectionMode プロパティが GestureOnly に設定されている場合、ユーザーがジェスチャを追加してから Gesture イベントが発生するまでのタイムアウトは、プログラムによって変更できない固定値です。ジェスチャ認識は InkAndGesture モードではより速くなります。

InkAndGesture モードのときに、インクのコレクションを回避するには

  • CollectionModeInkAndGesture に設定します。

  • Stroke イベントで、ストロークを削除します。

  • Gesture イベントでジェスチャを処理します。

ユーザーがジェスチャを記録しているときのインクのフローを回避するには、DynamicRendering プロパティを false に設定します。

Gesture イベントは、インクを挿入するときに加えて、選択モードまたは消去モードの場合も発生します。編集モードを追跡し、イベントを解釈する前にモードを認識する必要があります。

ms567635.alert_note(ja-jp,VS.90).gifメモ :

ジェスチャを認識するには、インクを収集できるオブジェクトまたはコントロールを使用する必要があります。

ms567635.alert_note(ja-jp,VS.90).gifメモ :

InkOverlay オブジェクトは、InkCollectorGestureEventHandler デリゲートを使用してジェスチャ イベント ハンドラを追加します。

この例では、イベント ハンドラによって、アプリケーション ジェスチャ情報がステータス バー ラベル 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;
        }
    }

}

関係のあるアプリケーション ジェスチャのみが、このイベントを発生させます。この例では、InkOverlay オブジェクトの mInkOverlay は、ApplicationGesture 列挙体の 4 つのジェスチャと関係があります。

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

インクおよびジェスチャの収集の前に、InkOverlay オブジェクト mInkOverlay がイベント ハンドラを登録します。

' register the Gesture event handler
AddHandler mInkOverlay.Gesture, New InkCollectorGestureEventHandler(AddressOf Event_OnApplicationGesture)
// register the Gesture event handler
mInkOverlay.Gesture += new InkCollectorGestureEventHandler(Event_OnApplicationGesture);

プラットフォーム

Windows Vista

.NET Framework および .NET Compact Framework では、各プラットフォームのすべてのバージョンはサポートしていません。サポートされているバージョンについては、「.NET Framework システム要件」を参照してください。

バージョン情報

.NET Framework

サポート対象 : 3.0

参照

参照

InkOverlay クラス

InkOverlay メンバ

Microsoft.Ink 名前空間

ApplicationGesture

InkCollectorGestureEventArgs

InkOverlay.SetGestureStatus