Condividi tramite


Metodo GestureRecognizer.Dispose

Aggiornamento: novembre 2007

Rilascia le risorse utilizzate dall'oggetto GestureRecognizer.

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

Sintassi

'Dichiarazione
Public Sub Dispose
'Utilizzo
Dim instance As GestureRecognizer

instance.Dispose()
public void Dispose()
public:
virtual void Dispose() sealed
public final void Dispose()
public final function Dispose()

Implementa

IDisposable.Dispose()

Note

Chiamando il metodo Dispose è possibile riallocare le risorse utilizzate dall'oggetto per altri scopi. Per ulteriori informazioni sulla procedura di Garbage Collection, vedere Programmazione di base per la procedura di Garbage Collection.

Avviso

Per evitare una perdita di memoria, è necessario chiamare in modo esplicito questo metodo su qualsiasi oggetto o controllo di Microsoft Windows XP Tablet PC Edition Software Development Kit (SDK) a cui è stato associato un gestore dell'evento prima che l'oggetto o il controllo esca dall'ambito.

Per qualsiasi classe nell'SDK di Tablet PC sulla quale è definito il metodo Dispose, eliminare manualmente ogni istanza di tale classe quando non è più necessaria. L'eliminazione di questi oggetti consentirà di migliorare le prestazioni dell'applicazione.

Esempi

Questo esempio C# è un frammento tratto dal gestore dell'evento Closed di un form che disabilita gli oggetti RealTimeStylus, GestureRecognizer e DynamicRenderer, svuota le code dell'oggetto RealTimeStylus e chiama il metodo Dispose degli oggetti.

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

// ...

// 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 Closed event handler.
private void theForm_Closed(object sender, System.EventArgs e)
{
    // Disable appropriate plug-ins.
    this.theGestureRecognizer.Enabled = false;
    this.theDynamicRenderer.Enabled = false;
    this.theFilterPlugin.Enabled = false;

    // Empty the RealTimeStylus queues
    this.thePrimaryRealTimeStylus.ClearStylusQueues();
    this.theSecondaryRealTimeStylus.ClearStylusQueues();

    // Disable the RealTimeStylus.
    this.thePrimaryRealTimeStylus.Enabled = false;

    // Dispose of the the RealTimeStylus objects and appropriate plug-ins.
    this.thePrimaryRealTimeStylus.Dispose();
    this.thePrimaryRealTimeStylus = null;
    this.theSecondaryRealTimeStylus.Dispose();
    this.theSecondaryRealTimeStylus = null;
    this.theDynamicRenderer.Dispose();
    this.theDynamicRenderer = null;
    this.theGestureRecognizer.Dispose();
    this.theGestureRecognizer = null;
}

Piattaforme

Windows Vista, Windows XP SP2, Windows Server 2003

.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

GestureRecognizer Classe

Membri GestureRecognizer

Spazio dei nomi Microsoft.StylusInput