StatusStrip

A StatusStrip displays window status. We use a ToolStripStatusLabel hyperlink in the C# Windows Forms status bar. We see an example of StatusStrip in Windows Forms, with tips on how to use its properties.

This article focuses on the StatusStrip control in Windows Forms.

StatusStrip screenshot

Introduction

I want to introduce some parts of the Windows Forms program we must be working with. There are other controls such as LinkLabel that you can use for links, but this article is about my favorite way, the hyperlink in the status bar. You need to be aware of the following properties.

StatusStrip. 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.

Status Items collection. Select the status strip control on your form, and in the Properties pane look through the entries there and select Items. There you can add new ToolStripStatusLabels and a hyperlink.

Steps to get started

I will assume you have a StatusStrip already. There are a few really important things you need to know. First of all, 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. Here are some steps.

Items dialogSteps

First, open Items dialog. On your StatusStrip, open the Items Collection Editor dialog in the A-Z listing. The Items dialog is pictured in the screenshot here.

Second, add some items. Leave the Status Label dropdown selected and click on the big Add button. You can also add other types of controls to your status strip here. To add a hyperlink, you can use a regular status label.

Third, add Spring item. Add a ToolStripStatusLabel with the Spring property set to true. Put it after the leftmost (first) status item. And next, add another status label after it. This will right-align the third status label.

Change Text property. On the right side of the Items Collection Editor dialog, you will see another grid list. Scroll to Text and type in the text of your link. Set IsLink to true. Again on the right side of the Items dialog, change the IsLink property to true.

Link behavior

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. To start a web browser, we will need to use the Process.Start method. In the new Click event handler, add the inner lines here.

Process.Start Examples
Implementation of Click event handler [C#]

private void toolStripStatusLabel3_Click(object sender, EventArgs e)
{
    // Launch Dot Net Perls website.
    // ... You should change the URL!
    System.Diagnostics.Process.Start("http://www.dotnetperls.com/");
}

Summary

Here I provided some quick steps on dealing with StatusStrip controls. I used the example of a right-aligned hyperlink to show how the system generally works. Finally, I want to say that a simple hyperlink in your status bar is very good for branding—it won't scare people off.

Windows Forms
.NET