Mouse.WheelExists 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取一个 Boolean 指示鼠标是否具有滚轮。
public:
property bool WheelExists { bool get(); };
public bool WheelExists { get; }
member this.WheelExists : bool
Public ReadOnly Property WheelExists As Boolean
属性值
如果鼠标具有滚轮,则为值为
例外
计算机未安装鼠标。
示例
此示例使用 My.Computer.Mouse.WheelExists 该属性来确定鼠标是否具有滚轮,以及旋转鼠标滚轮时滚动多少。
If My.Computer.Mouse.WheelExists Then
Dim lines As Integer = My.Computer.Mouse.WheelScrollLines
If lines > 0 Then
MsgBox("Application scrolls " &
lines & " line(s) for each wheel turn.")
Else
MsgBox("Application scrolls " &
(-lines) & " page(s) for each wheel turn.")
End If
Else
MsgBox("Mouse has no scroll wheel.")
End If
注解
该 My.Computer.Mouse.WheelExists 属性提供与属性类似的 MouseWheelPresent 功能。
在尝试访问WheelScrollLines该属性之前,应检查属性的值My.Computer.Mouse.WheelExists,如果鼠标没有滚轮,则会引发异常。
该 My.Computer.Mouse.WheelExists 属性提供有关运行代码的计算机的信息。
按项目类型提供可用性
| 项目类型 | 可用 |
|---|---|
| Windows 应用程序 | 是的 |
| 类库 | 是的 |
| 控制台应用程序 | 是的 |
| Windows 控件库 | 是的 |
| Web 控件库 | 否 |
| Windows 服务 | 是的 |
| 网站 | 否 |