Introduction
Almost all nice dialogs contain a white header bar with information about the current dialog etc. The only support in windows for dialog box headers is built into the property pages using Win32. To solve this, I created a few types of form header classes.
Features
- Font style of the title message and the body message can be changed. The title font style is set to bold by default
- Either an icon or an image can be displayed on the right side
- Depending on the derived class used, either a background image can be displayed or a color slide will be used as background
Classes in this assembly
The assembly contains 3 classes:
FormHeader
ImageFormHeader
ColorSlideFormHeader
|
FormHeader class
The simplest type of form header is the FormHeader class:
FormHeader provides a title text, a message text, an icon or an image. The background color is fixed to white.
this.formHeader1.Image = Image.FromFile( "HeaderImage.bmp" );
this.formHeader1.Message =
"This one is very simple. Black font on white backgr...";
this.formHeader1.Title = "FormHeader class Demo application";
This is the base class for all form header classes.
ImageFormHeader class
To include an image as a background, the class ImageFormHeader can be used.
It is derived from FormHeader .
this.imageFormHeader1.Image = Image.FromFile( "HeaderImage.bmp" );
this.imageFormHeader1.Message = "Here goes the message bla bla bla...";
this.imageFormHeader1.Title = "FormHeader class Demo Application";
this.imageFormHeader1.BackgroundImage =
Image.FromFile( "HeaderBackgroundImage.bmp" );
this.imageFormHeader1.BoundrySize = 5;
ColorSlideFormHeader class
Additionally, the ColorSlideFormHeader class provides a color slide background. The color slide start and end color can also be defined.
This class is also derived from FormHeader .
this.colorSlideFormHeader1.Color1 = System.Drawing.Color.White;
this.colorSlideFormHeader1.Color2 =
System.Drawing.Color.FromArgb(((System.Byte)(255)),
((System.Byte)(255)), ((System.Byte)(170)));
this.colorSlideFormHeader1.Message =
"This ColorSlideFormHeader class contains 2 ...";
this.colorSlideFormHeader1.Title =
"Welcome to the FormHeader demo application.";
|
Using the code
Using the control is very straight forward. First add a reference to your .NET project. Then add it to your tool box and drag it to your form. The control automatically docks to the top. All associated properties can be changed through the Visual Studio property window.
Download the whole solution which includes the source code and the demo application shown in the screenshots below.
Example Screenshots
Here are some example screenshots made with the interactive demo (also included in the download):
Feedback
Send me feedback if you have some additional ideas.
History
- May, 19. 2004 - Initial Version 1.0
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.