Keyboard.CapsLock 属性

定义

获取一个值,该值指示是否打开 CAPS LOCK。

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

属性值

一个值:如果启用 CAPS LOCK,则为 />;否则为

示例

此示例使用 My.Computer.Keyboard.CapsLock 属性来确定计算机的 CAPS LOCK 是否已打开。

If My.Computer.Keyboard.CapsLock Then
    MsgBox("CAPS LOCK on")
Else
    MsgBox("CAPS LOCK off")
End If

注解

仅返回 CAPS LOCK 的状态。

按项目类型提供可用性

项目类型 可用的
Windows 应用程序 Yes
类库 Yes
控制台应用程序 Yes
Windows 控件库 Yes
Web 控件库
Windows 服务 Yes
网站

适用于

另请参阅