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定义为附加事件的每个事件也由基元素类 UIElement 和 ContentElement 新的路由事件重新公开。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.
字段
属性
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. |
方法
附加事件
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. |