Condividi tramite


Evento InkCollector.Gesture

Aggiornamento: novembre 2007

Si verifica quando viene riconosciuto un movimento dell'applicazione.

Spazio dei nomi:  Microsoft.Ink
Assembly:  Microsoft.Ink (in Microsoft.Ink.dll)

Sintassi

'Dichiarazione
Public Event Gesture As InkCollectorGestureEventHandler
'Utilizzo
Dim instance As InkCollector
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 non supporta gli eventi.

Note

Affinché questo evento si verifichi, l'oggetto InkCollector deve avere un interesse in un insieme di movimenti dell'applicazione. Per impostare l'interesse dell'oggetto InkCollector in un insieme di movimenti, chiamare il metodo SetGestureStatus.

Per un elenco di movimenti specifici dell'applicazione, vedere l'enumerazione ApplicationGesture. Per ulteriori informazioni sui movimenti dell'applicazione, vedere Pen Input, Ink, and Recognition.

Il gestore eventi riceve un argomento di tipo InkCollectorGestureEventArgs contenente i dati relativi a questo evento.

Quando si crea un delegato InkCollectorGestureEventHandler, viene identificato il metodo che gestisce l'evento. Per associare l'evento al gestore eventi in uso, aggiungere all'evento un'istanza del delegato. Il gestore eventi viene chiamato ogni volta che si verifica l'evento, a meno che non si rimuova il delegato.

Quando la proprietà CollectionMode è impostata su GestureOnly, il timeout tra l'aggiunta di un movimento da parte dell'utente e la generazione dell'evento Gesture è un valore fisso che non è possibile modificare a livello di codice. Il riconoscimento del movimento è più veloce in modalità InkAndGesture.

Per evitare la raccolta dell'input penna nella modalità InkAndGesture:

Impostare la proprietà CollectionMode su InkAndGesture.

  • Eliminare l'oggetto Stroke nell'evento Stroke.

  • Elaborare il movimento nell'evento Gesture.

Per evitare il flusso di input penna durante l'esecuzione di movimenti, impostare la proprietà DynamicRendering su false.

Oltre che durante l'immissione di input penna, l'evento Gesture viene generato quando l'oggetto InkCollector si trova in modalità di selezione o di gomma. L'utente deve verificare la modalità di modifica ed essere consapevole di tale modalità prima di interpretare l'evento.

Nota

Per riconoscere i movimenti, è necessario utilizzare un oggetto o un controllo in grado di raccogliere l'input penna.

Nota

L'oggetto InkCollector utilizza il delegato InkCollectorGestureEventHandler per aggiungere un gestore eventi di movimento.

Esempi

Il gestore eventi di questo esempio visualizza le informazioni relative ai movimenti dell'applicazione su un'etichetta della barra di stato, 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;
        }
    }

}

Questo evento verrà generato solo dai movimenti dell'applicazione in cui è stato espresso un interesse. In questo esempio, l'oggetto InkCollector, mInkCollector esprime un interesse in quattro movimenti dell'enumerazione ApplicationGesture.

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

Prima della raccolta di input penna e movimenti, l'oggetto InkCollector, mInkCollector registra il gestore eventi.

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

Piattaforme

Windows Vista

.NET Framework e .NET Compact Framework non supportano tutte le versioni di ciascuna piattaforma. Per un elenco delle versioni supportate, vedere Requisiti di sistema di .NET Framework.

Informazioni sulla versione

.NET Framework

Supportato in: 3.0

Vedere anche

Riferimenti

InkCollector Classe

Membri InkCollector

Spazio dei nomi Microsoft.Ink

InkCollectorGestureEventArgs

ApplicationGesture

InkCollector.SetGestureStatus