MouseEventHandler MouseEventHandler MouseEventHandler MouseEventHandler Delegate

定義

代表將處理滑鼠相關路由事件的方法,這些事件並不特別涉及滑鼠按鈕或滑鼠滾輪 (例如 MouseMove)。Represents the method that will handle mouse related routed events that do not specifically involve mouse buttons or the mouse wheel; for example, MouseMove.

public delegate void MouseEventHandler(System::Object ^ sender, MouseEventArgs ^ e);
public delegate void MouseEventHandler(object sender, MouseEventArgs e);
type MouseEventHandler = delegate of obj * MouseEventArgs -> unit
Public Delegate Sub MouseEventHandler(sender As Object, e As MouseEventArgs)

參數

sender
Object Object Object Object

附加事件處理常式的物件。The object where the event handler is attached.

e
MouseEventArgs MouseEventArgs MouseEventArgs MouseEventArgs

事件資料。The event data.

繼承
MouseEventHandlerMouseEventHandlerMouseEventHandlerMouseEventHandler

備註

這個委派會使用下列的附加事件使用:This delegate is used with the following attached events:

這個委派會使用下列路由事件使用。This delegate is used with the following routed events. 這些路由的事件轉送先前所列出的附加的事件,使其更容易存取中的一般項目模型WPFWPFThese routed events forward the previously listed attached events to make them more accessible to the general element model in WPFWPF.

附加的事件和基底的項目路由事件共用其事件資料,而事件反昇和通道路由事件的版本也會共用事件資料。The attached events and the base element routed events share their event data, and the bubbling and tunneling versions of the routed events also share event data. 傳送的事件路由,這可能會影響事件的處理的特性。This can affect the handled characteristics of the event as it travels the event route. 如需詳細資訊,請參閱 < 輸入概觀For details, see Input Overview.

以外RoutedEventArgs屬性與相關的所有路由事件,最有趣的屬性MouseEventArgs中,您可能會使用MouseEventHandler實作數個屬性公開 (expose) 目前的按鈕狀態,例如LeftButtonMouseDeviceOther than the RoutedEventArgs properties that are relevant for all routed events, the most interesting properties of MouseEventArgs that you might use in a MouseEventHandler implementation are several properties that expose the current button state, such as LeftButton and MouseDevice. MouseDevice 很有用,特別是因為您可以檢查Captured在其上。MouseDevice is useful particularly because you can check Captured on it.

請注意,特別是處理滑鼠按鈕事件的事件會使用不同的委派, MouseButtonEventHandlerNote that events that specifically deal with mouse button events use a different delegate, MouseButtonEventHandler. 滑鼠按鈕屬性位於MouseEventArgs以防有輸入的模式] 或 [牽涉到按鈕,即使您要處理的非按鈕事件的互動。The mouse button properties are available on MouseEventArgs in case there are input modes or interactions that involve the buttons even if you are handling a non-button event.

擴充方法

GetMethodInfo(Delegate) GetMethodInfo(Delegate) GetMethodInfo(Delegate) GetMethodInfo(Delegate)

取得表示特定委派所代表之方法的物件。Gets an object that represents the method represented by the specified delegate.

適用於

另請參閱