Version

Set the Panel Style to KeyState

Key state refers to whether or not a special keyboard key is locked. The keys for which this property can be set are Num Lock, Caps Lock, Scroll Lock, Insert, and Kana (for use with Japanese characters). The KeyState style Panel indicates the current key lock state of the machine running the application.

Setting up KeyState Style Panel at Design-Time

  1. Add a UltraStatusBar to your Windows Form.

  2. In the Property Pages scroll down to the Panels Property. Click the ellipsis to bring up the Panels Collection.

  3. Click the "Add" button. This will add a new panel.

  4. Set the Style property of the panel to "KeyState".

  5. Open the KeyStateInfo property and select the key whose state you’d like to track.

  6. Choose the DisplayStyle you prefer. If you choose on and off, and would like to change the on and off text, do so in the space provided.

  7. Click OK and run your project.

Setting up KeyState Style Panel at Run-Time

To add a panel and set its type to "KeyState" at run-time, and set the properties mentioned above, use the following code.

In Visual Basic:

Imports Infragistics.Win.UltraWinStatusBar
...
Private Sub Set_the_Panel_Style_to_KeyState_Load(ByVal sender As System.Object, _
  ByVal e As System.EventArgs) Handles MyBase.Load
	Me.UltraStatusBar1.Panels.Add("KeyState", PanelStyle.KeyState)
	Me.UltraStatusBar1.Panels("KeyState").KeyStateInfo.Key = _
	  KeyState.CapsLock
	Me.UltraStatusBar1.Panels("KeyState").KeyStateInfo.DisplayStyle = _
	  KeyStateDisplayStyle.ChangeText
	Me.UltraStatusBar1.Panels("KeyState").KeyStateInfo.OffText = "NOCAPSLOCK"
	Me.UltraStatusBar1.Panels("KeyState").KeyStateInfo.OnText = "CAPSLOCK"
End Sub

In C#:

using Infragistics.Win.UltraWinStatusBar;
...
private void Set_the_Panel_Style_to_KeyState_Load(object sender, EventArgs e)
{
	this.ultraStatusBar1.Panels.Add("KeyState", PanelStyle.KeyState);
	this.ultraStatusBar1.Panels["KeyState"].KeyStateInfo.Key = KeyState.CapsLock;
	this.ultraStatusBar1.Panels["KeyState"].KeyStateInfo.DisplayStyle =
	  KeyStateDisplayStyle.ChangeText;
	this.ultraStatusBar1.Panels["KeyState"].KeyStateInfo.OffText = "NOCAPSLOCK";
	this.ultraStatusBar1.Panels["KeyState"].KeyStateInfo.OnText = "CAPSLOCK";
}