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.
- 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:
The simplest type of form header is the
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 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.
To include an image as a background, the class
ImageFormHeader can be used.
It is derived from
this.imageFormHeader1.Image = Image.FromFile( "HeaderImage.bmp" );
this.imageFormHeader1.Message = "Here goes the message bla bla bla...";
this.imageFormHeader1.Title = "FormHeader class Demo Application";
Image.FromFile( "HeaderBackgroundImage.bmp" );
this.imageFormHeader1.BoundrySize = 5;
ColorSlideFormHeader class provides a color slide background. The color slide start and end color can also be defined.
This class is also derived from
this.colorSlideFormHeader1.Color1 = System.Drawing.Color.White;
"This ColorSlideFormHeader class contains 2 ...";
"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.
Here are some example screenshots made with the interactive demo (also included in the download):
Send me feedback if you have some additional ideas.
- May, 19. 2004 - Initial Version 1.0