共用方式為


Mouse.WheelExists 屬性

定義

會顯示 Boolean 滑鼠是否有滾輪。

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

屬性值

若滑鼠有滾輪,則為值 True 的布林值;否則 False

例外狀況

電腦沒有安裝滑鼠。

範例

這個範例利用該 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.WheelExists 屬性提供與該 MouseWheelPresent 屬性類似的功能。

你應該在嘗試存取WheelScrollLines該物件前先檢查該物件的My.Computer.Mouse.WheelExists價值,如果滑鼠沒有滾輪,會拋出例外。

My.Computer.Mouse.WheelExists 屬性提供關於執行程式碼的電腦資訊。

依專案類型提供的可用性

專案類型 有現貨
Windows 應用程式 是的
類別庫 是的
主控台應用程式 是的
Windows 控制函式庫 是的
網頁控制函式庫 No
Windows 服務 是的
網站 No

適用於

另請參閱