ButtonBase.OnMouseLeftButtonDown(MouseButtonEventArgs) 方法

定義

提供 MouseLeftButtonDown 路由事件的類別處理,該事件於滑鼠指標在此控制項上方且按下滑鼠左鍵時發生。Provides class handling for the MouseLeftButtonDown routed event that occurs when the left mouse button is pressed while the mouse pointer is over this control.

protected:
 override void OnMouseLeftButtonDown(System::Windows::Input::MouseButtonEventArgs ^ e);
protected override void OnMouseLeftButtonDown (System.Windows.Input.MouseButtonEventArgs e);
override this.OnMouseLeftButtonDown : System.Windows.Input.MouseButtonEventArgs -> unit
Protected Overrides Sub OnMouseLeftButtonDown (e As MouseButtonEventArgs)

參數

e
MouseButtonEventArgs

事件資料。The event data.

備註

這個執行會藉MouseLeftButtonDownHandled將事件資料true的屬性設為時, 將事件標示為已處理, Hover而當不是設定為時ClickModeThis implementation marks the MouseLeftButtonDown event as handled by setting the Handled property of the event data to true when ClickMode is not set to Hover. 若要MouseLeftButtonDown回應事件, 請將事件處理常式附加handledEventsToo PreviewMouseLeftButtonDown至事件, 或使用AddHandler(RoutedEvent, Delegate, Boolean)設定為true的呼叫。To respond to the MouseLeftButtonDown event, attach an event handler to the PreviewMouseLeftButtonDown event, or call AddHandler(RoutedEvent, Delegate, Boolean) with handledEventsToo set to true.

ClickMode設定為PressClick , 這個方法會引發事件。When ClickMode is set to Press, this method raises the Click event.

給繼承者的注意事項

如果您覆OnMouseLeftButtonDown(MouseButtonEventArgs)寫, 請一律呼叫您OnMouseLeftButtonDown(MouseButtonEventArgs)的實作為基底執行。If you override OnMouseLeftButtonDown(MouseButtonEventArgs), always call the base implementation in your OnMouseLeftButtonDown(MouseButtonEventArgs) implementation. 若無法呼叫基底, 會使基類無法使用類別處理常式來處理事件, 這可能會變更最終類別的執行時間行為。Failure to call the base implementation prevents base classes from handling the event with a class handler, which might change the run-time behavior of the final class. 視您的需求而定, 您可以在特殊處理前後呼叫基底執行。You can call the base implementation either before or after your special handling, depending on your requirements.

適用於