Displaying Information with the Status Strip Control

The StatusStrip control allows you to display status information about the application. It's a subclass of the ToolStrip control and can host ToolStripItems. ToolStrip controls were covered in detail in Chapter 4, "ToolStrips, Menus, and Events." This section will focus on using the StatusStrip control to display information to the user.

The StatusStrip control is generally docked at the bottom edge of the form, although, like all ToolStrip controls, it can be docked at any edge, or it can even be undocked. You can add ToolStripItems to the Status strip either in the Designer or in code, as described in Chapter 4.

The two ToolStripItems that are commonly used to display information to the user in the StatusStrip control are the ToolStripStatusLabel control and the ToolStripProgressBar control. The ToolStripStatusLabel is a ToolStripItem control that emulates a Label control but resides in the StatusStrip control. The most important property of the ToolStripStatusLabel is the Text property, which represents the text that is displayed in the ToolStripStatusLabel control. You can set the text property, as shown in the following example:

ToolStripStatusLabell.Text = "Meltdown Imminent" // C#

toolStripStatusLabell.Text = "Meltdown Imminent";

The ToolStripProgressBar is a ToolStripItem control that emulates a ProgressBar control. ToolStripProgressBar exposes Minimum, Maximum, Step, and Value properties like the

ProgressBar control does, and these properties function in the same way as described in the previous section. Likewise, the ToolStripProgressBar exposes Increment and Perform-Step methods that advance the value in the same way as they do for the ProgressBar control.

Was this article helpful?

0 0

Post a comment