Ramblings & Controls from a .NET Addicted Freak!

Kevin Gearing's Blog

New Control - StatusBarEx - Extends the Base StatusBar Control

At the moment I'm in the process of re-writing an existing application, and throughout this application there are various workarounds I've employed to get around the limitations of the standard Windows Forms controls.

One of these limitations is not having a ProgressBar embedded within a StatusBar...

At the moment I hook into the Window_Resize event and move the ProgressBar whenever the window is resized, which does work quite well, but as I also use another workaround to display the date and time in a StatusBarPanel I decided that it was time to extend the base StatusBar with some helpful additions that I needed.

Now, you're probably thinking I could just have used one of the many StatusBar controls that other people have written, which I would have, but the biggest problem I found was that they didn't do exactly what I wanted and whilst some existed that did, it would mean buying a whole suite of controls just to get the StatusBar.

In the end I decided to just get on and write StatusBarEx.


Status Bar:

  • Set the background, foreground, border and gripper colours.
  • Supports drawing a flat border rather than a 3D border if required.
  • Includes two different renderers as default; WindowsDefaultRenderer and WindowsXpRenderer.
  • Theme aware when using WindowsXpRenderer (does not require a manifest).
  • Create your own renderers, simply implement the functions within IStatusBarExRenderer.
  • Supports all of the other standard StatusBar features.
  • Full Visual Studio .NET designer integration.

Status Bar Panels:

  • Set the background, foreground and border colours.
  • Choose from 10 different border styles.
  • Each panel has a standard 'Text' property allowing you to prefix the contents of the 'Value' property with your own text.
  • Two base panels you can inherit from; StatusBarExPanel and KeyStatePanel.
  • Some panels also have additional properties that can be set (see the documentation).
  • Supports icons and text alignment and all of the other standard StatusBarPanel features.

Panels Included:

  • CapsStatePanel, InsStatePanel, NumStatePanel and ScrollStatePanel - Detects and displays the state of keyboard keys (automatically updates).
  • DateTimePanel - Displays the current date and time (automatically updates).
  • FrameworkVersionPanel - Displays the .NET Framework version.
  • LabelPanel - Similar to the standard StatusBarPanel.
  • MachineNamePanel - Displays the machine name.
  • OsVersionPanel - Displays the operating system version information.
  • ProgressBarPanel - Displays a progress bar and acts similar to a standard ProgressBar control.
  • SystemUptimePanel - Displays the current system uptime (automatically updates).
  • UserNamePanel - Displays the user name of the currently logged in user.


Visual Studio .NET Design Time Notes:

  1. You must use the label buttons that appear under the property grid to add panels at design time to StatusBarEx. If you use the 'Add' button in the collection editor you will receive an exception. I am aware of this, but just haven't had the time to write my own collection editor. If the control is popular and I have the time I'll write one.
  2. Some properties depend on other property values. For example, if you set the border colour of a panel, you must set the 'BorderStyle' to 'Flat' for it to actually draw the border using the colour specified.

Windows Themes Support:

StatusBarEx will draw itself using Windows theming if you use the WindowsXpRenderer and if themes are enabled (otherwise it defaults to WindowsDefaultRenderer). At runtime, you don't need to add a manifest, simply add the usual Application.EnableVisualStyles() and Application.DoEvents() before you display any Forms.


Simply download, add to your toolbox, drag 'n' drop to you Form and set the relevant properties using the property grid.

Licensing & Download:

Free for both personal and commercial use, however please consider donating!

You may also redistribute the control royalty free, providing that you don't charge for it. Also, if you intend to distribute the control as part of an application which is publicly available it would be nice to know, although this isn't a requirement.

To download, please visit the 'Downloads' area.



Lee said:

Excellent control. Does exactly what I want it to, and I've had to search around a lot, was just about to start writing my own too.

If I may suggest a few small improvements:

1) Is there anyway to access the panel properties without having to CTYPE to them? A minor annoyance, compounded by...
2) A way to cycle thru the panels to access common properties, i.e. back colour
3) Some example snippets of example code in your help file would make it even more excellent. For instance, I can't get the XP rendering to work, looks good in Design mode, but reverts to flat style on runtime.
October 11, 2005 11:44 PM

Lee said:

And more importantly, any chance of having the code please? I don't really want to have to copy a DLL around with my exe, I'd like to embed it.
October 12, 2005 7:28 AM

Kevin Gearing said:

Hi Lee,

Sorry for the delay, I've been extremely busy over the last few weeks and haven't had the time to reply to anyone.

1) Unfortunately not, simply because I didn't write a StatusBarExPanelCollection class for the Panels property to use. Even if I had you would only be able to access the common properties and not propeties specific to a particular panel.

2) You can do this by iterating through the panels property and CTyping the panel to StatusBarExPanel (which all of the panels inherit from). You can then access the BackColor, BorderColor, BorderStyle, ForeColor, Style and Value properties.

3) With regards to XP rendering, set the Renderer property to WindowsXpRenderer and then in your application BEFORE you load or display ANY windows add:


Hope this helps.
October 19, 2005 2:04 PM

Kevin Gearing said:

Sorry, that should be Application.EnableVisualStyles. I missed the S off of the end.
October 19, 2005 2:05 PM

Kevin Gearing said:

Hi Lee,

The code isn't currently available for download at the moment. Sorry.
October 19, 2005 2:06 PM

Jon said:

This is a very nice control. Any chance of seeing a gradient background option?

P.S. - If you're ever inclined to share the source, I would also like to have that.
November 3, 2005 7:31 PM

Kevin Gearing said:


Thanks for your feedback.

As soon as I've got my hands on VS .NET 2005 (when it's available retail) I'll be testing StatusBarEx with .NET 2.0 and will look at adding a gradient background if I have time.
November 14, 2005 11:48 AM

Hismoom said:

this is an excellent control that you have developed.
I found one problem, though.
Ths DateTimePanel apparently does not correctly determine its size when setting the AutoSize property to StatusBarPanelAutoSize.Contents. You can barely see the first digit. In contrast, a LabelPanel set to display a datetime through a timer works just fine if set to StatusBarPanelAutoSize.Contents.
Can you confirm this problem? And if so, please correct it? This is just a minor bug, but one that could make the DateTimePanel quite useless.
January 8, 2006 2:34 AM

Tate Antrim said:

I can't live without StatusBarEx...I'm in VS2005 now and I've got an app that really needs it...anyway you can do a quick compile and send me the DLL?

I'd even let you MSTSC into my machine to do it!

Let me know ASAP
January 12, 2006 4:03 AM

Kevin Gearing said:

Hi there.

This is a strange one, the AutoSize.Contents setting isn't implemented by me but by the base StatusBar control which should be obviously sizing based on the contents of the panel.

Unfortunately with work committments at the moment I don't really have the time to go through the code and create a workaround.

I'm intending to release .NET 2.0 versions of my controls, but at the moment it's going to have to wait for a month.

January 17, 2006 10:55 AM

Dany said:

Hi there,

Excuse me for being daft but I can't quite figure out how to add plain old StatusBarPanel to StatusBarEx. I keep getting InvalidCastException.

I have a base form that has the status bar, and I'd like three panels in it: DateTimePanel, and two panels for login name and login role respectively. The last two panels will be populated dynamically at runtime.

I currently instantiate two statusbarpanels and in the base form's OnLoad handler I do:

public virtual void BaseForm_Load(object sender, System.EventArgs e)

Can you please enlighten me with how I can add more panels to the statusbar?

March 19, 2006 10:35 PM

Mona said:

I thought I could try and use this dll in MS Visual FoxPro 9, but it says the dll could not be registered. Is there anyone who can tell me a trick or is it possible it simply won't work with VFP?
March 20, 2006 10:55 AM

Kevin Gearing said:

Hi there,

Sorry, but I don't use VFP so I can't really answer your question - Anyone else have an idea?

March 20, 2006 4:10 PM

Kevin Gearing said:

Hi Dany,

You need to explicity cast the panel i.e.

statusBarEx1.Panels.Add(CType(Me.loginNamePanel, System.Windows.Forms.StatusBarPanel)

Hope that helps.

March 20, 2006 4:15 PM

Dany said:

Hi Kevin,

I tried that by doing:


but they still don't work. Both _loginRolePanel and _loginNamePanel are already instances of the StatusBarPanel class.

March 21, 2006 1:57 AM

Carlos said:

I know its been 7 months since Mona posted his question about using the status bar in VFP, but for anyone that may find this in the future, just google for ctl32_statusbar to find a VFP specific free status bar replacement, written 100% in VFP.
October 2, 2006 6:34 AM

KaiZeR DeathX said:

Exellent Controls
January 9, 2007 4:50 AM

Bob Banks said:

I tried your control and it seems to work quite well. I think it will do nicely in my application, but I have noticed a problem with the "ADD" button in panel properties window.
If you use the context menu to add panels, everything works quite well. If you ever click the "ADD" button when the panel properties window is open, the designer will crash (not the IDE [VS2005] or the project) and the StatusbarEX control must be deleted and a new one must be added the form. Since no one else appears to have noticed this problem I am beginning to wonder if this is an indication of a problem in my VS installation or the manner in which I added the reference to StatusbarEX although everything else seems to work.
I have a screen snap of the message box if you cannot recreate the problem.
In spite of this I have been able to use StatusbarEX without a single hiccup thus far. Good work!
February 18, 2007 9:45 PM

Kevin Gearing said:


Like you, I think that this is probably an issue with your VS install as I haven't been able to re-create the problem and I haven't heard the same from anyone else...

Let me know how you get on.

July 10, 2007 8:35 PM

Kevin Gearing said:

I'm intending to compile a .NET 2.0 version of StatusBarEx at some point, but if anyone would like it sooner rather than later, let me know and I'll see what I can do.

July 10, 2007 8:35 PM

Leave a Comment


Protected by FormShield
Please enter the characters shown on the image


Copyright ©2004-2007 Kevin Gearing. All Rights Reserved.
Powered by Community Server (Non-Commercial Edition), by Telligent Systems