共用方式為


RealTimeStylus.Enabled 屬性

取得或設定值,這個值表示是否已啟用 RealTimeStylus 物件。

命名空間:  Microsoft.StylusInput
組件:  Microsoft.Ink (在 Microsoft.Ink.dll 中)

語法

'宣告
Public Property Enabled As Boolean
'用途
Dim instance As RealTimeStylus
Dim value As Boolean

value = instance.Enabled

instance.Enabled = value
public bool Enabled { get; set; }
public:
property bool Enabled {
    bool get ();
    void set (bool value);
}
/** @property */
public boolean get_Enabled()
/** @property */
public  void set_Enabled(boolean value)
public function get Enabled () : boolean
public function set Enabled (value : boolean)

屬性值

型別:System.Boolean
是否已啟用 RealTimeStylus 物件。

意義

true

RealTimeStylus 物件已啟用,會收集手寫筆資料。

false

RealTimeStylus 物件已停用,不會收集手寫筆資料。

備註

這個屬性會在下列狀況下擲回例外狀況。

ms585380.alert_note(zh-tw,VS.90).gif注意事項:

當 Enabled 為 true 時,您可以從 RealTimeStylus 物件移除所有外掛程式。移除所有外掛程式不會變更 Enabled 的值。

ms585380.alert_note(zh-tw,VS.90).gif注意事項:

在特定訊息處理常式內使用時,設定此屬性可能會引發可重新進入的呼叫,造成未預期的結果。處理下列訊息時,請小心避免使用可重新進入的呼叫:WM_ACTIVATEWM_ACTIVATEAPPWM_NCACTIVATEWM_PAINTWM_SYSCOMMAND (如果 wParam 設定為 SC_HOTKEY 或 SC_TASKLIST) 和 WM_SYSKEYDOWN (處理 ALT+TAB 或 ALT+ESC 組合鍵時)。不過在單一執行緒 Apartment Model (STA) 應用程式中會發生問題。

範例

這個 Microsoft Visual C# .NET 範例是表單之 Load (英文) 事件處理常式的程式碼片段,會建立 GestureRecognizerDynamicRenderer 及兩個 RealTimeStylus 物件,將物件附加至串聯的 RealTimeStylus 模型中,並且啟用動態轉譯、筆勢辨識,以及透過 RealTimeStylus 物件進行 Tablet 畫筆資料收集。GestureRecognizer 物件會設定為辨識單一筆劃筆勢,以及只辨識 ApplicationGestureApplicationGestureApplicationGesture應用程式筆勢」。主要 RealTimeStylus 物件的 WindowInputRectangle 屬性會明確設為使用已附加 RealTimeStylus 物件的整個控制項。表單本身會實作 IStylusAsyncPlugin 介面,並且附加至 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;

    // ...
}

平台

Windows Vista, Windows XP SP2, Windows Server 2003

.NET Framework 和 .NET Compact Framework 並不支援各種平台的所有版本。如需支援平台版本的相關資訊,請參閱 .NET Framework 系統需求

版本資訊

.NET Framework

支援版本:3.0

請參閱

參考

RealTimeStylus 類別

RealTimeStylus 成員

Microsoft.StylusInput 命名空間

RealTimeStylus.WindowInputRectangle