StylusPlugIn.OnStylusLeave(RawStylusInput, Boolean) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
當手寫筆游標離開項目的範圍時,發生於畫筆執行緒上。
protected:
virtual void OnStylusLeave(System::Windows::Input::StylusPlugIns::RawStylusInput ^ rawStylusInput, bool confirmed);
protected virtual void OnStylusLeave (System.Windows.Input.StylusPlugIns.RawStylusInput rawStylusInput, bool confirmed);
abstract member OnStylusLeave : System.Windows.Input.StylusPlugIns.RawStylusInput * bool -> unit
override this.OnStylusLeave : System.Windows.Input.StylusPlugIns.RawStylusInput * bool -> unit
Protected Overridable Sub OnStylusLeave (rawStylusInput As RawStylusInput, confirmed As Boolean)
參數
- rawStylusInput
- RawStylusInput
包含畫筆輸入相關資訊的 RawStylusInput。
- confirmed
- Boolean
如果畫筆確實離開項目的界限則為 true
,否則為 false
。
範例
下列範例會在 StylusPlugIn 游標離開元素界限時重設 。
// StylusPointCollection that contains the stylus points of the current
// stroke.
StylusPointCollection points;
// Keeps track of the stylus to check whether two styluses are used on the
// digitizer.
int currentStylus;
' StylusPointCollection that contains the stylus points of the current
' stroke.
Private points As StylusPointCollection
' Keeps track of the stylus to check whether two styluses are used on the
' digitizer.
Private currentStylus As Integer
// If the element loses focus, stop collecting the points and don't
// perform gesture recognition.
protected override void OnStylusLeave(RawStylusInput rawStylusInput, bool confirmed)
{
if (confirmed)
{
// Clear the StylusPointCollection
points = null;
currentStylus = 0;
}
}
' If the element loses focus, stop collecting the points and don't
' perform gesture recognition.
Protected Overrides Sub OnStylusLeave(ByVal rawStylusInput As RawStylusInput, ByVal confirmed As Boolean)
If confirmed Then
' Clear the StylusPointCollection
points = Nothing
currentStylus = 0
End If
End Sub
備註
這個方法發生在畫筆執行緒上,因此請將此方法中的工作降到最低,以避免影響效能。