My.Computer.Mouse.WheelScrollLines 属性

更新:2007 年 11 月

获取一个数字,该数字指明在鼠标滚轮旋转一个齿格时滚动多少距离。

' Usage
Dim value As Integer = My.Computer.Mouse.WheelScrollLines
' Declaration
Public ReadOnly Property WheelScrollLines As Integer

返回值

一个指明鼠标滚轮旋转一个齿格时滚动多少距离的 Integer。正值指明按该行数滚动,而负值则指明一次滚动一屏。

异常

下面的情况可能会导致异常:

备注

可以使用此属性来确定在具有滚动条的多行控件中向上或向下滚动多少行数。

My.Computer.Mouse.WheelScrollLines 属性提供的功能与 MouseWheelScrollLines 属性类似。

由于此属性在鼠标没有滚轮时会引发异常,因此,您应通过检查 My.Computer.Mouse.WheelExists 属性来确保鼠标具有滚轮。

此属性提供了有关运行代码的计算机的信息。

示例

此示例确定鼠标是否具有滚轮,并使用 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

要求

命名空间:Microsoft.VisualBasic.Devices

类:Mouse

**程序集:**Visual Basic 运行库(位于 Microsoft.VisualBasic.dll 中)

按项目类型列出的可用性

项目类型

可用

Windows 应用程序

类库

控制台应用程序

Windows 控件库

Web 控件库

Windows 服务

网站

权限

不需要任何权限。

请参见

参考

My.Computer.Mouse 对象

My.Computer.Mouse.WheelExists 属性

Mouse.WheelScrollLines