通过


Mouse.WheelScrollLines 属性

定义

获取一个数字,该值指示在鼠标滚轮旋转一个圆圈时滚动多少。

public:
 property int WheelScrollLines { int get(); };
public int WheelScrollLines { get; }
member this.WheelScrollLines : int
Public ReadOnly Property WheelScrollLines As Integer

属性值

一个 Integer 指示在鼠标滚轮旋转一个圆圈时滚动多少。 正值表示按该行数滚动,负值表示一次滚动一个屏幕。

例外

鼠标没有滚轮。

示例

此示例确定鼠标是否具有滚轮,并使用 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.WheelScrollLines 属性提供与属性类似的 MouseWheelScrollLines 功能。

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

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

按项目类型提供可用性

项目类型 可用
Windows 应用程序 是的
类库 是的
控制台应用程序 是的
Windows 控件库 是的
Web 控件库
Windows 服务 是的
网站

适用于

另请参阅