Title: Make a status strip label that sticks to the right side of the form in C#
To create a status strip label, add a StatusStrip control to the form. When you select the StatusStrip, it should display an icon with a dropdown arrow. Click the arrow and select the kind of control you want to add to the StatusStrip. This can be StatusLabel, ProgressBar, DropDownButton, and SplitButton.
I recommend that you avoid the buttons and reserve the StatusStrip for status information and not commands.
If you set a status strip label control's Spring property to true, then that label takes up any space not used by other controls in the StatusStrip. If the status strip label is the last one in the StatusStrip, then it extends to the right edge of the StatusStrip. If you set its TextAlign property to MiddleRight, then the label places its text at the right edge of the StatusStrip.
Note that you can place controls both to the left and right of a label with Spring = true. In that case the label with Spring = true will take up whatever space is available.
You can also set Spring = true on more than one status strip label to make them share the available space.
The final point of interest in this example is the "Normal label" on the StatusStrip control's left side. That label's BorderSides property is set to All and its BorderStyle property is set to Sunken so it appears sunken below the surface of the form.
Download the example to experiment with it and to see additional details.
|