MouseEventArgs MouseEventArgs MouseEventArgs MouseEventArgs Class

定義

提供滑鼠相關路由事件的資料,這些事件並不特別涉及滑鼠按鈕或滑鼠滾輪,例如 MouseMoveProvides data for mouse related routed events that do not specifically involve mouse buttons or the mouse wheel, for example MouseMove.

public ref class MouseEventArgs : System::Windows::Input::InputEventArgs
public class MouseEventArgs : System.Windows.Input.InputEventArgs
type MouseEventArgs = class
    inherit InputEventArgs
Public Class MouseEventArgs
Inherits InputEventArgs
繼承
衍生

備註

這個事件資料類別會與下列附加事件搭配使用。This event data class is used with the following attached events.

這個事件資料類別會與下列路由事件搭配使用。This event data class is used with the following routed events. 這些路由事件會轉送先前列出的附加事件, 讓中WPFWPF的一般元素模型更容易存取。These 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.

除了與所有路由事件相關的MouseEventArgs MouseEventHandler屬性以外, 您可能在實中使用的最有趣屬性是會公開目前按鈕狀態的數個屬性 (例如RoutedEventArgs LeftButton)和MouseDevice)。Other 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.

請注意, 特別處理滑鼠按鍵事件的事件會使用不同的事件資料類別MouseButtonEventArgsNote that events that specifically deal with mouse button events use a different event data class, MouseButtonEventArgs. 當您正在處理非按鈕事件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.

Mouse類別會提供其他屬性和方法來判斷滑鼠的狀態。The Mouse class provides additional properties and methods for determining the state of the mouse.

建構函式

MouseEventArgs(MouseDevice, Int32) MouseEventArgs(MouseDevice, Int32) MouseEventArgs(MouseDevice, Int32) MouseEventArgs(MouseDevice, Int32)

使用指定的 MouseEventArgs 和時間戳記,初始化 MouseDevice 類別的新執行個體。Initializes a new instance of the MouseEventArgs class using the specified MouseDevice and timestamp

MouseEventArgs(MouseDevice, Int32, StylusDevice) MouseEventArgs(MouseDevice, Int32, StylusDevice) MouseEventArgs(MouseDevice, Int32, StylusDevice) MouseEventArgs(MouseDevice, Int32, StylusDevice)

使用指定的 MouseEventArgs、時間戳記和 MouseDevice,初始化 StylusDevice 類別的新執行個體。Initializes a new instance of the MouseEventArgs class using the specified MouseDevice, timestamp, and StylusDevice.

屬性

Device Device Device Device

取得初始化這個事件的輸入裝置。Gets the input device that initiated this event.

(Inherited from InputEventArgs)
Handled Handled Handled Handled

取得或設定值,這個值表示路由事件在傳送路由時之事件處理的目前狀態。Gets or sets a value that indicates the present state of the event handling for a routed event as it travels the route.

(Inherited from RoutedEventArgs)
LeftButton LeftButton LeftButton LeftButton

取得滑鼠左鍵的目前狀態。Gets the current state of the left mouse button.

MiddleButton MiddleButton MiddleButton MiddleButton

取得滑鼠中鍵的目前狀態。Gets the current state of the middle mouse button.

MouseDevice MouseDevice MouseDevice MouseDevice

取得與這個事件相關聯的滑鼠裝置。Gets the mouse device associated with this event.

OriginalSource OriginalSource OriginalSource OriginalSource

在父類別進行任何可能的 Source 調整之前,取得純點擊測試所判定的原始報告來源。Gets the original reporting source as determined by pure hit testing, before any possible Source adjustment by a parent class.

(Inherited from RoutedEventArgs)
RightButton RightButton RightButton RightButton

取得滑鼠右鍵的目前狀態。Gets the current state of the right mouse button.

RoutedEvent RoutedEvent RoutedEvent RoutedEvent

取得或設定與這個 RoutedEventArgs 執行個體相關聯的 RoutedEventGets or sets the RoutedEvent associated with this RoutedEventArgs instance.

(Inherited from RoutedEventArgs)
Source Source Source Source

取得或設定引發事件之物件的參考。Gets or sets a reference to the object that raised the event.

(Inherited from RoutedEventArgs)
StylusDevice StylusDevice StylusDevice StylusDevice

取得與這個事件相關聯的手寫筆裝置。Gets the stylus device associated with this event.

Timestamp Timestamp Timestamp Timestamp

取得這個事件發生的時間。Gets the time when this event occurred.

(Inherited from InputEventArgs)
XButton1 XButton1 XButton1 XButton1

取得第一個延伸的滑鼠按鍵的目前狀態。Gets the current state of the first extended mouse button.

XButton2 XButton2 XButton2 XButton2

取得第二個延伸的滑鼠按鍵的目前狀態。Gets the state of the second extended mouse button.

方法

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(Inherited from Object)
GetPosition(IInputElement) GetPosition(IInputElement) GetPosition(IInputElement) GetPosition(IInputElement)

傳回滑鼠指標相對於指定之項目的位置。Returns the position of the mouse pointer relative to the specified element.

GetType() GetType() GetType() GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(Inherited from Object)
InvokeEventHandler(Delegate, Object) InvokeEventHandler(Delegate, Object) InvokeEventHandler(Delegate, Object) InvokeEventHandler(Delegate, Object)

以型別專屬的方式叫用事件處理常式,這樣做能夠提升事件系統的效率。Invokes event handlers in a type-specific way, which can increase event system efficiency.

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(Inherited from Object)
OnSetSource(Object) OnSetSource(Object) OnSetSource(Object) OnSetSource(Object)

在衍生類別中覆寫時,每當執行個體的 Source 屬性值變更,便會提供通知回呼進入點。When overridden in a derived class, provides a notification callback entry point whenever the value of the Source property of an instance changes.

(Inherited from RoutedEventArgs)
ToString() ToString() ToString() ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(Inherited from Object)

適用於

另請參閱