in

dotNetFreak

Ramblings & Controls from a .NET Addicted Freak!

Kevin Gearing's Blog

June 2005 - Posts

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


    Features:

    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.


    Screenshots:




    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.


    Usage:

    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.

  • FormShield v1.1.2 Released

    FormShield v1.1.2 has been released. Click here for details.
  • FormShield v1.1.1 Released

    FormShield v1.1.1 has been released. Click here for details.
Copyright ©2004-2007 Kevin Gearing. All Rights Reserved.
Powered by Community Server (Non-Commercial Edition), by Telligent Systems