
Introduction
For all those who want to customize the caption bars in their applications here is the solution. This is the first stage of my effort in this direction, so the code here is not of very good quality. I feel there is room
for improvements and changes. Please feel free to write back to me if you find any
bugs.
The demo project contains two classes to customize your caption bar. The first class
is named CBeeChildFrame and will allow you to customize the caption bar for child frames and CBeeMainFrame lets you customize the main frame window.
It's very easy to implement the classes. You just have to specify the skin mages for
the caption bar's active and inactive states and the colors of the bar. (I'm looking for a better way to stretch the images so that i can get rid off the colors)
So download and enjoy. All the best!!!
How to skin the caption bars?
It's very easy to implement caption bar classes. After you have included the images for
the active and inactive states of the caption bar and the images for close, minimise, maximise and restore buttons (You
will get the best results if you have images for mouse over, inactive and normal states of the buttons) and have included the files of both classes i.e. CBeeChildFrame and CBeeMainFrame, just add the following code to the
constructor of your child frame class to skin the caption bar
CChildFrame::CChildFrame()
{
SetTitleImages(IDB_ACTIVE,IDB_INACTIVE);
SetTitleFontColor(RGB(255,171,197));
AddCloseButton(IDB_CLOSE_UP,IDB_CLOSE_DN,
IDB_CLOSE_UP_GR,IDB_CLOSE_UP_GR);
AddMaximizeButton(IDB_MAX_UP,IDB_MAX_DN_GR,
IDB_MAX_UP_GR,IDB_MAX_DN_GR);
AddMinimiseButton(IDB_MIN_UP,IDB_MIN_DN,
IDB_MIN_UP_GR,IDB_MIN_DN_GR);
AddRestoreButton(IDB_RESTORE_UP,IDB_RESTORE_DN,
IDB_RESTORE_UP_GR,IDB_RESTORE_DN_GR);
SetActiveWindowGradient(RGB(1,76,133),
RGB(146,164,176));
SetInactiveWindowGradient(RGB(122,122,122),
RGB(250,250,250));
}
and add the following to skin the caption bar of your main frame
CMainFrame::CMainFrame()
{
SetTitleImages(IDB_ACTIVE,IDB_INACTIVE);
SetTitleFontColor(RGB(255,171,197));
AddCloseButton(IDB_CLOSE_UP,IDB_CLOSE_DN,
IDB_CLOSE_UP_GR,IDB_CLOSE_UP_GR);
AddMaximizeButton(IDB_MAX_UP,IDB_MAX_DN_GR,
IDB_MAX_UP_GR,IDB_MAX_DN_GR);
AddMinimiseButton(IDB_MIN_UP,IDB_MIN_DN,
IDB_MIN_UP_GR,IDB_MIN_DN_GR);
AddRestoreButton(IDB_RESTORE_UP,IDB_RESTORE_DN,
IDB_RESTORE_UP_GR,IDB_RESTORE_DN_GR);
SetActiveWindowGradient(RGB(1,76,133),
RGB(146,164,176));
SetInactiveWindowGradient(RGB(122,122,122),
RGB(250,250,250));
}
Now all is done. You have skinned the caption bars in you MDI applications
Now since this is my first article to the CodeProject and its very late at night,
I'll explain this article in a couple of days, so please send me your feedback about the demo project.
Revision History
17 Jun 2002 - Initial Revision
17 Jun 2002 - Reformatted