釋放 RealTimeStylus 物件使用的所有資源。
命名空間: Microsoft.StylusInput
組件: Microsoft.Ink (在 Microsoft.Ink.dll 中)
語法
'宣告
Public Sub Dispose
'用途
Dim instance As RealTimeStylus
instance.Dispose()
public void Dispose()
public:
virtual void Dispose() sealed
public final void Dispose()
public final function Dispose()
實作
備註
呼叫 Dispose 方法可將物件使用的資源重新配置,以做為其他用途。
RealTimeStylus 物件不保證 Dispose 方法的執行緒安全。當其他執行緒可能正在使用 RealTimeStylus 物件時,請避免呼叫 Dispose 方法。
警告
從 Microsoft Windows XP Tablet PC Edition 軟體開發套件 (SDK) 開始,對於已附加事件處理常式的任何物件或控制項,您必須在物件或控制項超出範圍之前明確呼叫 Dispose 方法。
針對 Tablet PC SDK 中已定義 Dispose 的任何類別,請手動處置類別中不再需要的每一個執行個體。處置這些物件可以改善應用程式效能。
注意事項: |
|---|
如果 RealTimeStylus 物件的 Dispose 方法由其任何外掛程式從 IStylusSyncPlugin 或 IStylusAsyncPlugin 介面方法實作中呼叫,該物件會擲回例外狀況。 |
範例
這個 Microsoft Visual C# .NET 範例是表單之 Closed (英文) 事件處理常式的程式碼片段,會停用 RealTimeStylus、GestureRecognizer 和 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
注意事項: