Stylus.PreviewStylusOutOfRange Stylus.PreviewStylusOutOfRange Stylus.PreviewStylusOutOfRange Attached Event

定義

手寫筆超出平板電腦的範圍時發生。Occurs when the stylus goes out of range of the tablet.

see AddPreviewStylusOutOfRangeHandler, and RemovePreviewStylusOutOfRangeHandler
see AddPreviewStylusOutOfRangeHandler, and RemovePreviewStylusOutOfRangeHandler
see AddPreviewStylusOutOfRangeHandler, and RemovePreviewStylusOutOfRangeHandler

範例

下列範例示範如何判斷是否將手寫筆已反轉。The following example demonstrates how to determine whether the stylus is inverted. 這個範例假設有TextBoxtextBox1而且PreviewStylusOutOfRange事件所連接的事件處理常式。This example assumes there is a TextBox called textBox1 and that the PreviewStylusOutOfRange event is connected to the event handlers.

void textbox1_PreviewStylusOutOfRange(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_PreviewStylusOutOfRange(ByVal sender As Object, _
    ByVal e As StylusEventArgs) Handles textbox1.PreviewStylusOutOfRange

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

End Sub 'textbox1_PreviewStylusOutOfRange

備註

這是附加的事件。This is an attached event. WPFWPF 將附加的事件實作為路由事件。implements attached events as routed events. 基本上,附加的事件是XAMLXAML用來參考處理的事件未這麼做的物件本身會定義事件的語言概念。An attached event is, fundamentally, a XAMLXAML language concept used to reference events that are handled on objects that do not, themselves, define events. WPFWPF 進一步擴充附加的事件的功能,讓它可以周遊的路由。further expands an attached event's capabilities, allowing it to traverse a route. 附加的事件並沒有直接處理語法在程式碼若要附加的程式碼中的路由事件處理常式,使用指定的新增 * 處理常式方法。Attached events do not have a direct handling syntax in code; to attach handlers for a routed event in code, use a designated Add*Handler method. 如需詳細資訊,請參閱 < 附加事件概觀For details, see Attached Events Overview.

路由事件資訊Routed Event Information

識別項欄位Identifier field PreviewStylusOutOfRangeEvent
路由策略Routing strategy 通道Tunneling
Delegate - 委派Delegate StylusEventHandler

適用於

另請參閱