StatusStrip. A StatusStrip displays window status. It is usually at the bottom of a window. We use a ToolStripStatusLabel hyperlink in the C# Windows Forms status bar.
Intro. The StatusStrip is a control in your Toolbox in Visual Studio. Double click on its icon and then it will appear in the tray at the bottom of the Visual Studio window.
Hyperlink example. Double-click on the ToolStripStatusLabel you want to turn into a hyperlink. We must use the Click event handler to make the status item do something when it is clicked.
Detail To start a web browser, we will need to use the Process.Start method in System.Diagnostics.
Tip In the new Click event handler, add the inner line here. You can directly access System.Diagnostics.
private void toolStripStatusLabel3_Click(object sender, EventArgs e)
{
// Launch Dot Net Perls website.// ... You should change the URL!
System.Diagnostics.Process.Start( "https://www.dotnetperls.com/");
}
Alignment. All of the items will be squished to the left of the status strip by default. We can change this, and right-align a label.
Also To right-align things on a StatusStrip we add the Spring property on an item in between the left and right items.
Collections. Please open the Items dialog in Visual Studio. On your StatusStrip, open the Items Collection Editor dialog in the A-Z listing.
Tip The Items Collection Editor dialog is pictured in the screenshot here. It will look different in your version of Visual Studio.
Also To add a hyperlink, you can use a regular status label. You can make it a hyperlink later.
Summary. We added a StatusStrip. We used the example of a right-aligned hyperlink to show how the system works. A simple hyperlink in the status bar is good for branding.
Dot Net Perls is a collection of pages with code examples, which are updated to stay current. Programming is an art, and it can be learned from examples.
Donate to this site to help offset the costs of running the server. Sites like this will cease to exist if there is no financial support for them.
Sam Allen is passionate about computer languages, and he maintains 100% of the material available on this website. He hopes it makes the world a nicer place.
This page was last updated on Dec 24, 2024 (simplify).