NotificationBar gives you an easy to use control that can replace message boxes / pop up boxes where they are not really needed. When the need arises to display a small amount of information without distracting users with pop ups, this would be a solution worth checking out.
Anyone who has used IE6+ on Win XP SP2+ knows about those Information / Notification bars you get when trying to download a file etc. That is what I have brought here today. A small, completely C# version of that control.
- Works on .NET and Mono
- Can be used in commercial projects
- Can flash control any number of times
- Can use animation when showing and hiding the control
- Can play sound when shown
- Automatic word-wrap
Using the code
This control is very easy to use.
The classes and methods included in this library are listed below.
Control class, the
NotificationBar class is the only class in the library and houses the control.
ContextMenuStrip seen when the control is clicked.
ImageList used for displaying an image on the far left side of the control.
Sets the image index of an image in the
SmallImageList to be used in the control.
The class constructor method.
Draws the text seen on the control.
Draws the close button seen on the far right side of the control.
Overridden methods and properties where left out of the list above.
Using the control is as easy as this:
NotificationBar infoBar = new NotificationBar ();
infoBar.Name = "informationBar1";
infoBar.Size = new Size(100, 20);
infoBar.Dock = DockStyle.Top;
infoBar.Font = new Font(FontFamily.GenericSansSerif, 8.25f);
infoBar.Text = "Hello, here is some info!";
infoBar.OnClickMenuStrip = contextMenuStrip1;
infoBar.SmallImageList = imageList1;
infoBar.ImageIndex = 2;
These are the results you should get:
Normal view of information bar with short string:
Hovered view of information bar with short string:
And finally, the normal and hovered states with a longer string:
June 04, 2008 - Version 1.0.0 released
June 04, 2008 - Version 1.0.1 released
- Changed the location of the close button.
- Fixed the issue of image not changing after setting a new index.
July 02, 2008 - Version 1.0.2 released
- Tested and works on Mono.
- Renamed control to NotificationBar.
- Added ability to flash control.
- Added ability to play notification sound when control is shown.
- Added designer support for property values.
July 27, 2008 - Version 1.0.4 released
- Updated to where text color changes with background.
- Added ability to animate showing and hiding the control.
- Added screenshot of control working in Linux using Mono.