แก้ไข

แชร์ผ่าน


Mouse.WheelScrollLines Property

Definition

Gets a number that indicates how much to scroll when the mouse wheel is rotated one notch.

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

Property Value

An Integer that indicates how much to scroll when the mouse wheel is rotated one notch. A positive value indicates scrolling by that number of lines, while a negative value indicates scrolling by one screen at a time.

Exceptions

The mouse has no scroll wheel.

Examples

This example determines if the mouse has a scroll wheel and uses the My.Computer.Mouse.WheelExists property to determine how much to scroll when the mouse wheel is rotated.

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

Remarks

You can use this property to determine how many lines to scroll up or down in a multi-line control that has a scroll bar.

The My.Computer.Mouse.WheelScrollLines property provides functionality similar to the MouseWheelScrollLines property.

Because this property throws an exception if the mouse does not have a scroll wheel, you should make sure a mouse has a scroll wheel by checking the My.Computer.Mouse.WheelExists property.

This property provides information about the computer that runs the code.

Availability by Project Type

Project type Available
Windows Application Yes
Class Library Yes
Console Application Yes
Windows Control Library Yes
Web Control Library No
Windows Service Yes
Web Site No

Applies to

See also