Click here to Skip to main content
Click here to Skip to main content

FormHeader control

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

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

License

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

Share

About the Author

TeeBee303
Web Developer
Switzerland Switzerland
No Biography provided

Comments and Discussions

 
QuestionLicense? Pinmemberguidedways19-Mar-08 7:39 
General"Read only" failure PinmemberDenMelton16-Jan-06 5:20 
GeneralRe: "Read only" failure PinmemberTeeBee30316-Jan-06 21:40 
GeneralRe: "Read only" failure PinmemberDenMelton17-Jan-06 5:28 
GeneralRe: "Read only" failure Pinmemberemanlee27-Jan-07 22:21 
GeneralMissing the Images Pinmembergarythom_usa28-May-04 1:07 
GeneralRe: Missing the Images PinmemberTeeBee30328-May-04 1:38 
GeneralRe: Missing the Images Pinmembergarythom_usa28-May-04 2:48 
GeneralLinear Wash Code Pinmembernorm.net28-May-04 0:22 
GeneralRe: Linear Wash Code PinmemberTeeBee30328-May-04 0:32 
GeneralRe: Linear Wash Code Pinmembernorm.net28-May-04 0:46 

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

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

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