Z
Z.K.
I am trying to detect if the Numlock is pressed. I can do it okay with
the CapsLock or the ScrLk, but not with NumLock. The code for all three
checks is exactly the same, but for some reason numlock always thinks it
is on.
Z.K.
code:
private void MainForm_KeyDown(object sender, KeyEventArgs e)
{
if (Control.IsKeyLocked(Keys.NumLock))
{
MessageBox.Show("The Num Lock key is ON.");
}
else
{
MessageBox.Show("The Num Lock key is OFF.");
}
if (Control.IsKeyLocked(Keys.CapsLock))
{
MessageBox.Show("The Caps Lock key is ON.");
}
else
{
MessageBox.Show("The Caps Lock key is OFF.");
}
if (Control.IsKeyLocked(Keys.Scroll))
{
MessageBox.Show("The Scroll Lock key is ON.");
}
else
{
MessageBox.Show("The Scroll Lock key is OFF.");
}
}
the CapsLock or the ScrLk, but not with NumLock. The code for all three
checks is exactly the same, but for some reason numlock always thinks it
is on.
Z.K.
code:
private void MainForm_KeyDown(object sender, KeyEventArgs e)
{
if (Control.IsKeyLocked(Keys.NumLock))
{
MessageBox.Show("The Num Lock key is ON.");
}
else
{
MessageBox.Show("The Num Lock key is OFF.");
}
if (Control.IsKeyLocked(Keys.CapsLock))
{
MessageBox.Show("The Caps Lock key is ON.");
}
else
{
MessageBox.Show("The Caps Lock key is OFF.");
}
if (Control.IsKeyLocked(Keys.Scroll))
{
MessageBox.Show("The Scroll Lock key is ON.");
}
else
{
MessageBox.Show("The Scroll Lock key is OFF.");
}
}