InkCanvas.Gesture 事件
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
當 InkCanvas 偵測到筆勢時,就會發生。
public:
event System::Windows::Controls::InkCanvasGestureEventHandler ^ Gesture;
public event System.Windows.Controls.InkCanvasGestureEventHandler Gesture;
member this.Gesture : System.Windows.Controls.InkCanvasGestureEventHandler
Public Custom Event Gesture As InkCanvasGestureEventHandler
事件類型
範例
下列範例示範如何設定 InkCanvas 以辨識應用程式手勢。
// Add this code to the contstructor or OnLoaded method.
if (inkCanvas1.IsGestureRecognizerAvailable)
{
inkCanvas1.EditingMode = InkCanvasEditingMode.InkAndGesture;
inkCanvas1.Gesture += new InkCanvasGestureEventHandler(inkCanvas1_Gesture);
inkCanvas1.SetEnabledGestures(new ApplicationGesture[]
{ApplicationGesture.Down,
ApplicationGesture.ArrowDown,
ApplicationGesture.Circle});
}
' Add this code to the contstructor or OnLoaded method.
If (inkCanvas1.IsGestureRecognizerAvailable) Then
inkCanvas1.EditingMode = InkCanvasEditingMode.InkAndGesture
Dim gestures() As ApplicationGesture = _
{ApplicationGesture.Down, _
ApplicationGesture.ArrowDown, _
ApplicationGesture.Circle}
inkCanvas1.SetEnabledGestures(gestures)
End If
void inkCanvas1_Gesture(object sender, InkCanvasGestureEventArgs e)
{
ReadOnlyCollection<GestureRecognitionResult> gestureResults =
e.GetGestureRecognitionResults();
// Check the first recognition result for a gesture.
if (gestureResults[0].RecognitionConfidence ==
RecognitionConfidence.Strong)
{
switch (gestureResults[0].ApplicationGesture)
{
case ApplicationGesture.Down:
// Do something.
break;
case ApplicationGesture.ArrowDown:
// Do something.
break;
case ApplicationGesture.Circle:
// Do something.
break;
}
}
}
Sub inkCanvas1_Gesture(ByVal sender As Object, _
ByVal e As InkCanvasGestureEventArgs) Handles inkCanvas1.Gesture
Dim gestureResults As ReadOnlyCollection(Of GestureRecognitionResult)
gestureResults = e.GetGestureRecognitionResults()
' Check the first recognition result for a gesture.
If gestureResults(0).RecognitionConfidence = _
RecognitionConfidence.Strong Then
Select Case gestureResults(0).ApplicationGesture
Case ApplicationGesture.Down
' Do something.
Case ApplicationGesture.ArrowDown
' Do something.
Case ApplicationGesture.Circle
' Do something.
End Select
End If
End Sub
備註
路由事件資訊
識別碼欄位 | GestureEvent |
路由策略 | 鼓 泡 |
代理人 | InkCanvasGestureEventHandler |