InkCanvas.SetEnabledGestures(IEnumerable<ApplicationGesture>) Método
Definición
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
Establece los gestos de la aplicación que InkCanvas va a reconocer.
public:
void SetEnabledGestures(System::Collections::Generic::IEnumerable<System::Windows::Ink::ApplicationGesture> ^ applicationGestures);
public void SetEnabledGestures (System.Collections.Generic.IEnumerable<System.Windows.Ink.ApplicationGesture> applicationGestures);
member this.SetEnabledGestures : seq<System.Windows.Ink.ApplicationGesture> -> unit
Public Sub SetEnabledGestures (applicationGestures As IEnumerable(Of ApplicationGesture))
Parámetros
- applicationGestures
- IEnumerable<ApplicationGesture>
Colección de gestos de la aplicación que InkCanvas va a reconocer.
Excepciones
La propiedad IsGestureRecognizerAvailable es false
.
Comentarios
En el ejemplo siguiente se muestra cómo configurar un InkCanvas para reconocer gestos de aplicación.
// 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