Compartir a través de


GestureRecognizer.EnableGestures (Método)

Actualización: noviembre 2007

Establece un valor que indica si el objeto GestureRecognizer tiene interés o no en un movimiento de aplicación conocido.

Espacio de nombres:  Microsoft.StylusInput
Ensamblado:  Microsoft.Ink (en Microsoft.Ink.dll)

Sintaxis

'Declaración
Public Sub EnableGestures ( _
    gestures As ApplicationGesture() _
)
'Uso
Dim instance As GestureRecognizer
Dim gestures As ApplicationGesture()

instance.EnableGestures(gestures)
public void EnableGestures(
    ApplicationGesture[] gestures
)
public:
void EnableGestures(
    array<ApplicationGesture>^ gestures
)
public void EnableGestures(
    ApplicationGesture[] gestures
)
public function EnableGestures(
    gestures : ApplicationGesture[]
)

Parámetros

Comentarios

Se producirá una excepción ArgumentException si se intenta habilitar AllGestures junto con otros movimientos.

Ejemplos

Este ejemplo de C# es un fragmento de un controlador de eventos Load de un formulario, que crea un objeto GestureRecognizer, DynamicRenderer, y dos objetos RealTimeStylus, asocia los objetos en un modelo RealTimeStylus en cascada y habilita la representación dinámica, el reconocimiento de movimientos y la recopilación de datos de lápiz de Tablet PC a través de RealTimeStylus. El objeto GestureRecognizer se establece para reconocer los movimientos de un solo trazo y para reconocer sólo los movimientos de aplicación Right, ChevronRight y ArrowRight. La propiedad WindowInputRectangle del objeto RealTimeStylus primario se establece explícitamente para usar todo el control al que está asociado el objeto RealTimeStylus. El formulario implementa por sí mismo la interfaz IStylusAsyncPlugin y se asocia al objeto RealTimeStylus.

using Microsoft.Ink;
using Microsoft.StylusInput;
using Microsoft.StylusInput.PluginData;

// ...

// The panel where the tablet pen data is collected.
private System.Windows.Forms.Panel thePanel;

// Declare the RealTimeStylus objects, the GestureRecognizer plugin,
// and the DynamicRenderer plug-in.
private Microsoft.StylusInput.RealTimeStylus thePrimaryRealTimeStylus = null;
private Microsoft.StylusInput.RealTimeStylus theSecondaryRealTimeStylus = null;
private Microsoft.StylusInput.GestureRecognizer theGestureRecognizer = null;
private Microsoft.StylusInput.DynamicRenderer theDynamicRenderer = null;

// The form's Load event handler.
private void theForm_Load(object sender, System.EventArgs e)
{
    // ...

    // Create a DynamicRenderer attached to the drawing area ,
    // and enable dynamic rendering.
    this.theDynamicRenderer = new DynamicRenderer(this.thePanel);
    this.theDynamicRenderer.Enabled = true;

    // Create a GestureRecognizer, and set it to recognize single-stroke gestures.
    this.theGestureRecognizer = new GestureRecognizer();
    this.theGestureRecognizer.MaxStrokeCount = 1;

    // Allow gesture recognition for specific gestures.
    this.theGestureRecognizer.EnableGestures( new ApplicationGesture[]
        {
            ApplicationGesture.Right,
            ApplicationGesture.ChevronRight,
            ApplicationGesture.ArrowRight
        } );

    // Enable gesture recognition.
    this.theGestureRecognizer.Enabled = true;

    // Create the primary and secondary RealTimeStylus objects.
    this.thePrimaryRealTimeStylus = new RealTimeStylus(this.thePanel);
    this.theSecondaryRealTimeStylus = new RealTimeStylus();

    // Add the secondary RealTimeStylus to the primary's asynchronous plug-in collection.
    this.thePrimaryRealTimeStylus.AsyncPluginCollection.Add(
        this.theSecondaryRealTimeStylus);

    // Add the dynamic renderer to the primary's synchronous plug-in collection.
    this.thePrimaryRealTimeStylus.SyncPluginCollection.Add(this.theDynamicRenderer);

    // Add the gesture recognizer to the secondary's synchronous plug-in collection.
    this.theSecondaryRealTimeStylus.SyncPluginCollection.Add(this.theGestureRecognizer);

    // Add the form to the secondary's asynchronous plug-in colleciton.
    this.theSecondaryRealTimeStylus.AsyncPluginCollection.Add(this);

    // Set the input rectangle to the entire panel for the RealTimeStylus.
    this.thePrimaryRealTimeStylus.WindowInputRectangle = new Rectangle(0,0,0,0);

    // Enable the RealTimeStylus, which allows notifications to flow to the plug-ins.
    this.thePrimaryRealTimeStylus.Enabled = true;

    // ...
}

Plataformas

Windows Vista, Windows XP SP2, Windows Server 2003

.NET Framework y .NET Compact Framework no admiten todas las versiones de cada plataforma. Para obtener una lista de las versiones compatibles, vea Requisitos de sistema de .NET Framework.

Información de versión

.NET Framework

Compatible con: 3.0

Vea también

Referencia

GestureRecognizer (Clase)

GestureRecognizer (Miembros)

Microsoft.StylusInput (Espacio de nombres)

ApplicationGesture