Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Customized Skinned Caption for MDI

0.00/5 (No votes)
16 Jun 2002 6  
Make your customized skinned caption bar for MDI

Sample Image - CustomCaptionMDI.gif

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 images 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 your MDI applications.
Now since this is my first article on Code Project and it's 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

  • 17th June, 2002 - Initial revision
  • 17th June, 2002 - Reformatted

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.

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