Mouse.WheelExists 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取一个 Boolean 值,该值指示鼠标是否具有滚轮。
public:
property bool WheelExists { bool get(); };
public bool WheelExists { get; }
member this.WheelExists : bool
Public ReadOnly Property WheelExists As Boolean
属性值
如果鼠标具有滚轮,则返回值为 Boolean 值 True;否则返回 False。
例外
计算机未安装鼠标。
示例
此示例使用 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 服务 | 是 |
| 网站 | 否 |