Stylus.GotStylusCapture 附加事件

定義

在項目擷取手寫筆事件時發生。

see AddGotStylusCaptureHandler, and RemoveGotStylusCaptureHandler
see AddGotStylusCaptureHandler, and RemoveGotStylusCaptureHandler
see AddGotStylusCaptureHandler, and RemoveGotStylusCaptureHandler

範例

下列範例示範如何在擷取和釋放手寫筆事件時TextBox變更的背景色彩TextBox。 此範例假設有一個稱為 textBox1的文本框,而且 GotStylusCaptureLostStylusCapture 事件會連線到事件處理程式。

void textbox1_LostStylusCapture(object sender, StylusEventArgs e)
{
    textbox1.Background = Brushes.White;
}

void textbox1_GotStylusCapture(object sender, StylusEventArgs e)
{
    textbox1.Background = Brushes.Red;
}
Private Sub textbox1_LostStylusCapture(ByVal sender As Object, ByVal e As StylusEventArgs) _
    Handles textbox1.LostStylusCapture

    textbox1.Background = Brushes.White

End Sub


Private Sub textbox1_GotStylusCapture(ByVal sender As Object, ByVal e As StylusEventArgs) _
    Handles textbox1.GotStylusCapture

    textbox1.Background = Brushes.Red

End Sub

備註

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

路由事件資訊

標識元欄位 GotStylusCaptureEvent
路由策略 鼓 泡
代理人 StylusEventHandler

適用於

另請參閱