There is a method for getting modifier key states on the keyboard. It is discussed in our FAQ entry:
http://www.syncfusion.com/faq/winforms/search/656.asp
BUT this technique does not work for the CAPS LOCK key. So, the only way I know to get the state of the CAPS LOCK key is to use P/Invoke. Below is some code that seem to work for me.
using System.Runtime.InteropServices;
...
...
[DllImport("user32.dll")]
public static extern long GetKeyState(int vKey);
const int VK_CAPITAL = 0x14;
private void button1_Click(object sender, System.EventArgs e)
{
if( GetKeyState(VK_CAPITAL) != 0)
Console.WriteLine("the X-CapLock key is down");
}
HTH,
Clay Burch