Click here to Skip to main content
12,956,777 members (66,795 online)
Click here to Skip to main content
Add your own
alternative version


70 bookmarked
Posted 27 May 2004

FormHeader control

, 27 May 2004
Rate this:
Please Sign up or sign in to vote.
Custom FormHeader Control


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:

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


Send me feedback if you have some additional ideas.


  • May, 19. 2004 - Initial Version 1.0


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Web Developer
Switzerland Switzerland
No Biography provided

You may also be interested in...


Comments and Discussions

QuestionLicense? Pin
guidedways19-Mar-08 6:39
memberguidedways19-Mar-08 6:39 
General"Read only" failure Pin
DenMelton16-Jan-06 4:20
memberDenMelton16-Jan-06 4:20 
GeneralRe: "Read only" failure Pin
TeeBee30316-Jan-06 20:40
memberTeeBee30316-Jan-06 20:40 
GeneralRe: "Read only" failure Pin
DenMelton17-Jan-06 4:28
memberDenMelton17-Jan-06 4:28 
GeneralRe: "Read only" failure Pin
emanlee27-Jan-07 21:21
memberemanlee27-Jan-07 21:21 
GeneralMissing the Images Pin
garythom_usa28-May-04 0:07
membergarythom_usa28-May-04 0:07 
GeneralRe: Missing the Images Pin
TeeBee30328-May-04 0:38
memberTeeBee30328-May-04 0:38 
GeneralRe: Missing the Images Pin
garythom_usa28-May-04 1:48
membergarythom_usa28-May-04 1:48 
GeneralLinear Wash Code Pin
norm.net27-May-04 23:22
membernorm.net27-May-04 23:22 
GeneralRe: Linear Wash Code Pin
TeeBee30327-May-04 23:32
memberTeeBee30327-May-04 23:32 
GeneralRe: Linear Wash Code Pin
norm.net27-May-04 23:46
membernorm.net27-May-04 23:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170525.1 | Last Updated 28 May 2004
Article Copyright 2004 by TeeBee303
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid