Stylus.PreviewStylusInRange 附加事件

定義

手寫筆進入平板電腦的範圍內時發生。

see AddPreviewStylusInRangeHandler, and RemovePreviewStylusInRangeHandler
see AddPreviewStylusInRangeHandler, and RemovePreviewStylusInRangeHandler
see AddPreviewStylusInRangeHandler, and RemovePreviewStylusInRangeHandler

範例

下列範例示範如何判斷手寫筆是否反轉。 這個範例假設有呼叫 TextBoxtextBox1 的 ,而且 PreviewStylusInRange 事件已連接到事件處理程式。

void textbox1_PreviewStylusInRange(object sender, StylusEventArgs e)
{
    if (e.StylusDevice.Inverted)
    {
        textbox1.AppendText("Pen is inverted\n");
    }
    else
    {
        textbox1.AppendText("Pen is not inverted\n");
    }
}
Private Sub textbox1_PreviewStylusInRange(ByVal sender As Object, _
    ByVal e As StylusEventArgs) Handles textbox1.PreviewStylusInRange

    If e.StylusDevice.Inverted Then
        textbox1.AppendText("Pen is inverted" & vbLf)
    Else
        textbox1.AppendText("Pen is not inverted" & vbLf)
    End If

End Sub

備註

這是附加的事件。 WPF 會將附加事件實作為路由事件。 附加事件基本上是 XAML 語言概念,用來參考物件上未處理的事件本身定義事件。 WPF 會進一步擴充附加事件的功能,讓它周遊路由。 附加事件在程式代碼中沒有直接處理語法;若要在程式代碼中附加路由事件的處理程式,請使用指定的 Add*Handler 方法。 如需詳細資訊,請參閱 附加事件概觀

路由事件資訊

標識元欄位 PreviewStylusInRangeEvent
路由策略 隧道
代理人 StylusEventHandler

適用於

另請參閱