次の方法で共有


GestureRecognizer.Dispose メソッド

GestureRecognizer オブジェクトによって使用されているリソースを解放します。

名前空間 :  Microsoft.StylusInput
アセンブリ :  Microsoft.Ink (Microsoft.Ink.dll 内)

構文

'宣言
Public Sub Dispose
'使用
Dim instance As GestureRecognizer

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

実装

IDisposable.Dispose()

解説

Dispose メソッドを呼び出すと、オブジェクトによって使用されているリソースを他の目的のために再割り当てできます。ガベージ コレクションの詳細については、「ガベージ コレクションのプログラミング」を参照してください。

ms574611.alert_caution(ja-jp,VS.90).gif注意 :

メモリ リークを避けるために、Microsoft Windows XP Tablet PC Edition Software Development Kit (SDK) では、イベント ハンドラがアタッチされているオブジェクトまたはコントロールがスコープの外に出る前に、それらのオブジェクトまたはコントロールでこのメソッドを明示的に呼び出す必要があります。

Dispose メソッドが定義されている、Tablet PC SDK 内の任意のクラスについて、そのクラスのインスタンスが不要になった場合は、手動で破棄してください。これらのオブジェクトの破棄により、アプリケーションのパフォーマンスが向上します。

この C# の例は、フォームの Closed イベント ハンドラのスニペットです。これにより、RealTimeStylusGestureRecognizer、および DynamicRenderer オブジェクトを無効にし、RealTimeStylus オブジェクトのキューを空にして、オブジェクトの Dispose メソッドを呼び出します。

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;
}

プラットフォーム

Windows Vista, Windows XP SP2, Windows Server 2003

.NET Framework および .NET Compact Framework では、各プラットフォームのすべてのバージョンはサポートしていません。サポートされているバージョンについては、「.NET Framework システム要件」を参照してください。

バージョン情報

.NET Framework

サポート対象 : 3.0

参照

参照

GestureRecognizer クラス

GestureRecognizer メンバ

Microsoft.StylusInput 名前空間