Método Shape.IsKeyLocked
Determina se a tecla CAPS LOCK, NUM LOCK ou SCROLL LOCK está em vigor.
Namespace: Microsoft.VisualBasic.PowerPacks
Assembly: Microsoft.VisualBasic.PowerPacks.Vs (em Microsoft.VisualBasic.PowerPacks.Vs.dll)
Sintaxe
'Declaração
Public Shared Function IsKeyLocked ( _
keyVal As Keys _
) As Boolean
public static bool IsKeyLocked(
Keys keyVal
)
public:
static bool IsKeyLocked(
Keys keyVal
)
static member IsKeyLocked :
keyVal:Keys -> bool
public static function IsKeyLocked(
keyVal : Keys
) : boolean
Parâmetros
- keyVal
Tipo: System.Windows.Forms.Keys
O membro de CAPS LOCK, NUM LOCK ou SCROLL LOCK da Keys enumeração.
Valor de retorno
Tipo: System.Boolean
true Se a chave especificada ou chaves estão em vigor; Caso contrário, false.
Exceções
Exceção | Condição |
---|---|
NotSupportedException | O keyVal parâmetro se refere a uma chave diferente, por exemplo, a tecla CAPS LOCK, NUM LOCK ou SCROLL LOCK. |
Comentários
Use o IsKeyLocked propriedade para determinar se as teclas CAPS LOCK, NUM LOCK ou SCROLL LOCK são, individualmente ou em combinação.
Exemplos
O exemplo a seguir exibe uma caixa de mensagem indicando se a chave especificada (a tecla CAPS LOCK neste caso) está em vigor.
Private Sub GetCapsLocked(ByVal shape As Shape)
' You can test for the CAPS LOCK, NUM LOCK, OR SCROLL LOCK key
' by changing the value of Keys.
If shape.IsKeyLocked(Keys.CapsLock) Then
MsgBox("The Caps Lock key is ON.")
Else
MsgBox("The Caps Lock key is OFF.")
End If
End Sub
private void GetCapsLocked(Shape shape)
{
// You can test for the CAPS LOCK, NUM LOCK, OR SCROLL LOCK key
// by changing the value of Keys.
if (Shape.IsKeyLocked(Keys.CapsLock))
{
MessageBox.Show("The Caps Lock key is ON.");
}
else
{
MessageBox.Show("The Caps Lock key is OFF.");
}
}
Segurança do .NET Framework
- Confiança total para o chamador imediato. O membro não pode ser usado por código parcialmente confiável. Para obter mais informações, consulte Usando bibliotecas de código parcialmente confiáveis.
Consulte também
Referência
Namespace Microsoft.VisualBasic.PowerPacks
Outros recursos
Como: desenhar linhas com o controle de LineShape (Visual Studio)
Como: desenhar formas com os controles de RectangleShape (Visual Studio) e o OvalShape