Mouse 類別

定義

表示特定執行緒的滑鼠裝置。Represents the mouse device to a specific thread.

public ref class Mouse abstract sealed
public static class Mouse
type Mouse = class
Public Class Mouse
繼承
Mouse

備註

Mouse類別提供滑鼠相關事件、方法和屬性, 以提供有關滑鼠狀態的資訊。The Mouse class provides mouse related events, methods and, properties which provide information regarding the state of the mouse.

定義為附加Mouse事件的每個事件也會由基底元素類別UIElementContentElement新的路由事件重新公開。Each event that Mouse defines as an attached event is also re-exposed by the base element classes UIElement and ContentElement as a new routed event. 一般來說, 在和UIElement ContentElement上處理應用程式的滑鼠事件會比較方便, 而不是使用Mouse事件。Generally, it is more convenient to handle mouse events for an application on UIElement and ContentElement, rather than using the Mouse events. 如需詳細資訊, 請參閱輸入總覽For details, see Input Overview.

Mouse類別的靜態成員會委派給呼叫執行緒的MouseDevice輸入管理員的主要。The static members of the Mouse class delegate to the primary MouseDevice of the calling thread's input manager.

欄位

GotMouseCaptureEvent

識別 GotMouseCapture 附加事件。Identifies the GotMouseCapture attached event.

LostMouseCaptureEvent

識別 LostMouseCapture 附加事件。Identifies the LostMouseCapture attached event.

MouseDownEvent

識別 MouseDown 附加事件。Identifies the MouseDown attached event.

MouseEnterEvent

識別 MouseEnter 附加事件。Identifies the MouseEnter attached event.

MouseLeaveEvent

識別 MouseLeave 附加事件。Identifies the MouseLeave attached event.

MouseMoveEvent

識別 MouseMove 附加事件。Identifies the MouseMove attached event.

MouseUpEvent

識別 MouseUp 附加事件。Identifies the MouseUp attached event.

MouseWheelDeltaForOneLine

表示旋轉滑鼠滾輪以捲動一行的單位數。Represents the number of units the mouse wheel is rotated to scroll one line.

MouseWheelEvent

識別 MouseWheel 附加事件。Identifies the MouseWheel attached event.

PreviewMouseDownEvent

識別 PreviewMouseDown 附加事件。Identifies the PreviewMouseDown attached event.

PreviewMouseDownOutsideCapturedElementEvent

識別 PreviewMouseDownOutsideCapturedElement 附加事件。Identifies the PreviewMouseDownOutsideCapturedElement attached event.

PreviewMouseMoveEvent

識別 PreviewMouseMove 附加事件。Identifies the PreviewMouseMove attached event.

PreviewMouseUpEvent

識別 PreviewMouseUp 附加事件。Identifies the PreviewMouseUp attached event.

PreviewMouseUpOutsideCapturedElementEvent

識別 PreviewMouseUpOutsideCapturedElement 附加事件。Identifies the PreviewMouseUpOutsideCapturedElement attached event.

PreviewMouseWheelEvent

識別 PreviewMouseWheel 附加事件。Identifies the PreviewMouseWheel attached event.

QueryCursorEvent

識別 QueryCursor 附加事件。Identifies the QueryCursor attached event.

屬性

Captured

取得已捕捉滑鼠的項目。Gets the element that has captured the mouse.

DirectlyOver

取得滑鼠指標位於其正上方的項目。Gets the element the mouse pointer is directly over.

LeftButton

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

MiddleButton

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

OverrideCursor

取得或設定整個應用程式的游標。Gets or sets the cursor for the entire application.

PrimaryDevice

取得主要滑鼠裝置。Gets the primary mouse device.

RightButton

取得右鍵的狀態。Gets the state of the right button.

XButton1

取得第一個延伸按鍵的狀態。Gets the state of the first extended button.

XButton2

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

方法

AddGotMouseCaptureHandler(DependencyObject, MouseEventHandler)

加入 GotMouseCapture 附加事件的處理常式。Adds a handler for the GotMouseCapture attached event.

AddLostMouseCaptureHandler(DependencyObject, MouseEventHandler)

加入 LostMouseCapture 附加事件的處理常式。Adds a handler for the LostMouseCapture attached event.

AddMouseDownHandler(DependencyObject, MouseButtonEventHandler)

加入 MouseDown 附加事件的處理常式。Adds a handler for the MouseDown attached event.

AddMouseEnterHandler(DependencyObject, MouseEventHandler)

加入 MouseEnter 附加事件的處理常式。Adds a handler for the MouseEnter attached event.

AddMouseLeaveHandler(DependencyObject, MouseEventHandler)

加入 MouseLeave 附加事件的處理常式。Adds a handler for the MouseLeave attached event.

AddMouseMoveHandler(DependencyObject, MouseEventHandler)

加入 MouseMove 附加事件的處理常式。Adds a handler for the MouseMove attached event.

AddMouseUpHandler(DependencyObject, MouseButtonEventHandler)

加入 MouseUp 附加事件的處理常式。Adds a handler for the MouseUp attached event.

AddMouseWheelHandler(DependencyObject, MouseWheelEventHandler)

加入 MouseWheel 附加事件的處理常式。Adds a handler for the MouseWheel attached event.

AddPreviewMouseDownHandler(DependencyObject, MouseButtonEventHandler)

加入 PreviewMouseDown 附加事件的處理常式。Adds a handler for the PreviewMouseDown attached event.

AddPreviewMouseDownOutsideCapturedElementHandler(DependencyObject, MouseButtonEventHandler)

加入 PreviewMouseDownOutsideCapturedElement 附加事件的處理常式。Adds a handler for the PreviewMouseDownOutsideCapturedElement attached event.

AddPreviewMouseMoveHandler(DependencyObject, MouseEventHandler)

加入 PreviewMouseMove 附加事件的處理常式。Adds a handler for the PreviewMouseMove attached event.

AddPreviewMouseUpHandler(DependencyObject, MouseButtonEventHandler)

加入 PreviewMouseUp 附加事件的處理常式。Adds a handler for the PreviewMouseUp attached event.

AddPreviewMouseUpOutsideCapturedElementHandler(DependencyObject, MouseButtonEventHandler)

加入 PreviewMouseUpOutsideCapturedElement 附加事件的處理常式。Adds a handler for the PreviewMouseUpOutsideCapturedElement attached event.

AddPreviewMouseWheelHandler(DependencyObject, MouseWheelEventHandler)

加入 PreviewMouseWheel 附加事件的處理常式。Adds a handler for the PreviewMouseWheel attached event.

AddQueryCursorHandler(DependencyObject, QueryCursorEventHandler)

加入 QueryCursor 附加事件的處理常式。Adds a handler for the QueryCursor attached event.

Capture(IInputElement)

將滑鼠輸入捕捉至指定的項目。Captures mouse input to the specified element.

Capture(IInputElement, CaptureMode)

使用指定的 CaptureMode 將滑鼠輸入捕捉至指定項目。Captures mouse input to the specified element using the specified CaptureMode.

GetIntermediatePoints(IInputElement, Point[])

擷取自上次滑鼠移動事件後最多 64 個滑鼠指標的先前座標。Retrieves up to 64 previous coordinates of the mouse pointer since the last mouse move event.

GetPosition(IInputElement)

取得相對於指定項目的滑鼠位置。Gets the position of the mouse relative to a specified element.

RemoveGotMouseCaptureHandler(DependencyObject, MouseEventHandler)

移除 GotMouseCapture 附加事件的處理常式。Removes a handler for the GotMouseCapture attached event.

RemoveLostMouseCaptureHandler(DependencyObject, MouseEventHandler)

移除 LostMouseCapture 附加事件的處理常式。Removes a handler for the LostMouseCapture attached event.

RemoveMouseDownHandler(DependencyObject, MouseButtonEventHandler)

移除 MouseDown 附加事件的處理常式。Removes a handler for the MouseDown attached event.

RemoveMouseEnterHandler(DependencyObject, MouseEventHandler)

移除 MouseEnter 附加事件的處理常式。Removes a handler for the MouseEnter attached event.

RemoveMouseLeaveHandler(DependencyObject, MouseEventHandler)

移除 MouseLeave 附加事件的處理常式。Removes a handler for the MouseLeave attached event.

RemoveMouseMoveHandler(DependencyObject, MouseEventHandler)

移除 MouseMove 附加事件的處理常式。Removes a handler for the MouseMove attached event.

RemoveMouseUpHandler(DependencyObject, MouseButtonEventHandler)

移除 MouseUp 附加事件的處理常式。Removes a handler for the MouseUp attached event.

RemoveMouseWheelHandler(DependencyObject, MouseWheelEventHandler)

移除 MouseWheel 附加事件的處理常式。Removes a handler for the MouseWheel attached event.

RemovePreviewMouseDownHandler(DependencyObject, MouseButtonEventHandler)

移除 PreviewMouseDown 附加事件的處理常式。Removes a handler for the PreviewMouseDown attached event.

RemovePreviewMouseDownOutsideCapturedElementHandler(DependencyObject, MouseButtonEventHandler)

移除 PreviewMouseDownOutsideCapturedElement 附加事件的處理常式。Removes a handler for the PreviewMouseDownOutsideCapturedElement attached event.

RemovePreviewMouseMoveHandler(DependencyObject, MouseEventHandler)

移除 PreviewMouseMove 附加事件的處理常式。Removes a handler for the PreviewMouseMove attached event.

RemovePreviewMouseUpHandler(DependencyObject, MouseButtonEventHandler)

移除 PreviewMouseUp 附加事件的處理常式。Removes a handler for the PreviewMouseUp attached event.

RemovePreviewMouseUpOutsideCapturedElementHandler(DependencyObject, MouseButtonEventHandler)

移除 PreviewMouseUpOutsideCapturedElement 附加事件的處理常式。Removes a handler for the PreviewMouseUpOutsideCapturedElement attached event.

RemovePreviewMouseWheelHandler(DependencyObject, MouseWheelEventHandler)

移除 PreviewMouseWheel 附加事件的處理常式。Removes a handler for the PreviewMouseWheel attached event.

RemoveQueryCursorHandler(DependencyObject, QueryCursorEventHandler)

移除 QueryCursor 附加事件的處理常式。Removes a handler for the QueryCursor attached event.

SetCursor(Cursor)

將滑鼠指標設定為指定的 CursorSets the mouse pointer to the specified Cursor.

Synchronize()

強制滑鼠重新同步處理。Forces the mouse to resynchronize.

UpdateCursor()

強制執行滑鼠游標的更新。Forces the mouse cursor to be updated.

附加事件

GotMouseCapture

發生於項目捕捉到滑鼠時。Occurs when an element captures the mouse.

LostMouseCapture

發生於項目失去滑鼠捕捉時。Occurs when an element loses mouse capture.

MouseDown

發生於按下任何滑鼠按鍵時。Occurs when any mouse button is depressed.

MouseEnter

發生於滑鼠指標進入項目的範圍時。Occurs when the mouse pointer enters the boundaries of an element.

MouseLeave

發生於滑鼠指標離開項目的範圍時。Occurs when the mouse pointer leaves the boundaries of an element.

MouseMove

發生於移動滑鼠指標時。Occurs when the mouse pointer moves.

MouseUp

發生於放開任何滑鼠按鍵時。Occurs when any mouse button is released.

MouseWheel

發生於旋轉滑鼠滾輪時。Occurs when the mouse wheel is rotated.

PreviewMouseDown

發生於按下任何滑鼠按鍵時。Occurs when any mouse button is depressed.

PreviewMouseDownOutsideCapturedElement

發生於在捕捉滑鼠事件的項目之外按下主要滑鼠按鍵時。Occurs when the primary mouse button is pressed outside the element that is capturing mouse events.

PreviewMouseMove

發生於滑鼠移到項目上方時。Occurs when the mouse moves over an element.

PreviewMouseUp

發生於放開任何滑鼠按鍵時。Occurs when any mouse button is released.

PreviewMouseUpOutsideCapturedElement

發生於在捕捉滑鼠事件的項目之外放開主要滑鼠按鍵時。Occurs when the primary mouse button is released outside the element that is capturing mouse events.

PreviewMouseWheel

發生於旋轉滑鼠滾輪時。Occurs when the mouse wheel rotates.

QueryCursor

發生於項目查詢目前滑鼠游標時。Occurs when an element queries for the current mouse cursor.

適用於