共用方式為


My.Computer.Mouse Property 

Gets an object that provides properties for getting information about the format and configuration of the mouse installed on the local computer.

' Usage
Dim value As Microsoft.VisualBasic.Devices.Mouse = My.Computer.Mouse
' Declaration
Public ReadOnly Property Mouse As Microsoft.VisualBasic.Devices.Mouse

Return Value

This property returns the My.Computer.Mouse object for the computer.

Remarks

This property provides easy access to the My.Computer.Mouse object. For more information, see My.Computer.Mouse Object.

This property is available only for non-server applications.

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: Computer

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

Permissions

No permissions are required.

See Also

Reference

My.Computer Object
My.Computer.Mouse Object