แก้ไข

แชร์ผ่าน


Mouse.WheelExists Property

Definition

Gets a Boolean that indicates if the mouse has a scroll wheel.

public:
 property bool WheelExists { bool get(); };
public bool WheelExists { get; }
member this.WheelExists : bool
Public ReadOnly Property WheelExists As Boolean

Property Value

A Boolean with value True if the mouse has a scroll wheel; otherwise False.

Exceptions

The computer has no mouse installed.

Examples

This example uses the My.Computer.Mouse.WheelExists property to determine if the mouse has a scroll wheel and 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

The My.Computer.Mouse.WheelExists property provides functionality similar to the MouseWheelPresent property.

You should check the value of the My.Computer.Mouse.WheelExists property before attempting to access the WheelScrollLines property, which throws an exception if the mouse does not have a scroll wheel.

The My.Computer.Mouse.WheelExists 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