共用方式為


My.Computer.Mouse Object 

Provides properties for getting information about the format and configuration of the mouse installed on the local computer.

Remarks

The My.Computer.Mouse object provides a way to find information about the computer's mouse: whether the mouse buttons are swapped, and details about the mouse wheel.

Example

This example uses the My.Computer.Mouse.WheelExists and My.Computer.Mouse.WheelScrollLines properties to determine if the mouse has a scroll wheel and how much to scroll when it rotates.

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

Requirements

Namespace: Microsoft.VisualBasic.Devices

Class: Mouse

Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)

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

See Also

Reference

My.Computer.Mouse Object Members
My.Computer Object
Microsoft.VisualBasic.Devices.Mouse