RealTimeStylus.WindowInputRectangle 屬性
取得或設定 RealTimeStylus 物件的輸入矩形。
命名空間: Microsoft.StylusInput
組件: Microsoft.Ink (在 Microsoft.Ink.dll 中)
語法
'宣告
Public Property WindowInputRectangle As Rectangle
'用途
Dim instance As RealTimeStylus
Dim value As Rectangle
value = instance.WindowInputRectangle
instance.WindowInputRectangle = value
public Rectangle WindowInputRectangle { get; set; }
public:
property Rectangle WindowInputRectangle {
Rectangle get ();
void set (Rectangle value);
}
/** @property */
public Rectangle get_WindowInputRectangle()
/** @property */
public void set_WindowInputRectangle(Rectangle value)
public function get WindowInputRectangle () : Rectangle
public function set WindowInputRectangle (value : Rectangle)
屬性值
型別:System.Drawing.Rectangle
RealTimeStylus 物件的輸入矩形 (以像素為單位)。
值 |
意義 |
---|---|
(0, 0, 0, 0) |
輸入矩形對應至視窗界限。 |
System.Drawing.Rectangle |
輸入矩形對應至 Rectangle (英文) 物件。 |
備註
輸入矩形是視窗界限和這個屬性之值的交集。當這個屬性設定為空白矩形時,RealTimeStylus 物件收集的範圍會是整個視窗,即使視窗調整大小時也一樣。
一旦 RealTimeStylus 物件開始收集手寫板畫筆資料,即使手寫筆移至輸入區域外,它也會繼續收集資料,直到使用者舉起手寫筆為止。您可以選擇另外在附加的 IStylusSyncPlugin 物件或附加的 IStylusAsyncPlugin 物件中,處理輸入區域外收集的手寫板畫筆資料。
這個屬性會在下列狀況下擲回例外狀況。
RealTimeStylus 物件已經過處置。
在使用 RealTimeStylus() 建構函式建立的 RealTimeStylus 物件上設定這個屬性。
![]() |
---|
在特定訊息處理常式內使用時,設定或取得此屬性可能會引發可重新進入的呼叫,造成未預期的結果。處理下列訊息時,請小心避免使用可重新進入的呼叫:WM_ACTIVATE、WM_ACTIVATEAPP、WM_NCACTIVATE、WM_PAINT、WM_SYSCOMMAND (如果 wParam 設定為 SC_HOTKEY 或 SC_TASKLIST) 和 WM_SYSKEYDOWN (處理 ALT+TAB 或 ALT+ESC 組合鍵時)。不過在單一執行緒 Apartment Model (STA) 應用程式中會發生問題。 |
範例
這個 Microsoft Visual C# .NET 範例是表單之 Load (英文) 事件處理常式的程式碼片段,會建立 GestureRecognizer、DynamicRenderer 及兩個 RealTimeStylus 物件,將物件附加至串聯的 RealTimeStylus 模型中,並且啟用動態轉譯、筆勢辨識,以及透過 RealTimeStylus 物件進行 Tablet 畫筆資料收集。GestureRecognizer 物件會設定為辨識單一筆劃筆勢,以及只辨識 ApplicationGesture、ApplicationGesture 和 ApplicationGesture「應用程式筆勢」。主要 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