次の方法で共有


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
アプリケーション ジェスチャの値。

解説

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

Gesture オブジェクトの識別子は、変更されることがないため、時間が経過しても一定です。

各アプリケーション ジェスチャは ApplicationGesture 列挙体の値として存在するため、値はそのジェスチャの ID として機能します。

この例では、アプリケーション ジェスチャが認識されたときにイベント ハンドラが発生します。イベントは、アプリケーションによって (SetGestureStatus メソッドを呼び出すことで) 特に要求された ApplicationGesture 型によってのみ発生します。イベント ハンドラに渡された最初の Gesture オブジェクトを調べているときに、Check ジェスチャに対して Confidence プロパティに強い信頼性が設定されている場合は、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