How to change the color of a button when Num, Caps, or Scroll Lock are on?

  • Thread starter Thread starter Kevin
  • Start date Start date
K

Kevin

Hello,
I am working on a C# program for class. I have made a keyboard typing
program and want to be able to have it detect if the Caps, Num, and
Scroll Lock keys are on or off at program startup. I have made three
buttons representing each of these (like the lights on any keyboard
representing if these controls are on or off). If any of these keys
are on at startup, I want the program to be able to detect it and
change the color of the button(s) to a different color. I cannot
figure out how to do this for the life of me. Any help on this would
be greatly appreciated. Thanks.
 
Take a look at the Control.ModifierKeys property. It's a static method
(i.e. available from anywhere) that will give you this information.

Tom Clement
Apptero, Inc.
 
Kevin said:
I am working on a C# program for class. I have made a
keyboard typing program and want to be able to have it
detect if the Caps, Num, and Scroll Lock keys are on or
off at program startup. I have made three buttons representing
each of these (like the lights on any keyboard representing if
these controls are on or off).

You may want to set up a keyboard hook:

<http://www.developer.com/net/net/article.php/11087_2193301_1>
 
Back
Top