StylusPlugIn.OnStylusLeave(RawStylusInput, Boolean) 方法

定义

当光标离开元素的边界时在笔线程上发生。

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

注解

此方法在笔线程上发生,因此尽量减少此方法中的工作,以避免影响性能。

适用于