Click here to Skip to main content
Click here to Skip to main content
Go to top

Customized Skinned Caption for MDI

, 16 Jun 2002
Rate this:
Please Sign up or sign in to vote.
Make your customized skinned caption bar for MDI
<!-- Download Links --> <!-- Article image -->

Sample Image - CustomCaptionMDI.gif

<!-- Add the rest of your HTML here -->

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

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

Ashok Jaiswal
Web Developer
Hong Kong Hong Kong
innovating, managing and developing next generation media products and services

Comments and Discussions

 
Questionhow to change the background of menubar and status bar PinmemberBlrBoy26-Jun-07 0:58 
Generalgod example, but many gdi leaks! (solution inside) PinmemberCodeFlatter22-Oct-05 6:02 
QuestionCan you update the code with all bugfixes Pinmembertim63510-Jul-05 22:45 
AnswerRe: Can you update the code with all bugfixes PinsussAnonymous11-Jul-05 15:20 
Generalgod job!! suggest use uskin-- another personal free skin lib Pinmemberthirdwolf26-Jun-05 17:39 
GeneralSystem Menu Pinmemberfeeeto30-Mar-05 22:30 
QuestionHow to change the color of the caption bar with win32 API Pinmembernjdibfm20-Jan-05 18:23 
GeneralChildFrame caption Cancel (X) button on PocketPC PinsussMike Landis18-Jan-05 11:37 
GeneralAnother ugly bug PinmemberYacine9500029-Jul-04 5:12 
GeneralRe: Another ugly bug PinsussAnonymous31-May-05 19:09 
GeneralCDialog with a round rect PinsussAnonymous11-Jun-03 4:36 
GeneralCDialog with a round rect PinsussAnonymous11-Jun-03 4:36 
Generalreally cool PinmemberRaphael Amorim11-Feb-03 10:55 
GeneralAnother way for skinnable SDI/MDI/Dialog application Pinmemberjedyking22-Jan-03 6:31 
GeneralRe: Another way for skinnable SDI/MDI/Dialog application Pinmember-wolfy-17-Mar-03 12:15 
GeneralRe: Another way for skinnable SDI/MDI/Dialog application PinmemberCalder19-Jan-04 9:48 
GeneralRe: Another way for skinnable SDI/MDI/Dialog application PinmemberTrungHuynh1-Jun-04 21:28 
Generalalmost compiles but... Pinmemberm1k3d3s22-Jan-03 5:45 
GeneralRe: almost compiles but... PinsussAnonymous11-Feb-03 23:58 
Generalpls let me know Pinmembersaurabh_p_agashe26-Dec-02 18:53 
GeneralGod job.but.... Pinmemberxipeng10-Nov-02 20:47 
GeneralRe: God job.but.... PinsussAnonymous10-Nov-02 22:06 
GeneralRe: God job.but.... Pinmemberxipeng11-Nov-02 3:35 
GeneralMemory leaks! Pinmemberdicker18-Aug-02 23:42 
GeneralRe: Memory leaks! Pinmembersclhj2001@hotmail.com21-May-04 1:53 
GeneralSize and XP PinmemberAnonymous26-Jun-02 6:28 
GeneralRe: Size and XP PinmemberKoushiro7-Jul-02 6:51 
GeneralRe: Size and XP PinmemberBalkrishna Talele29-Dec-03 1:06 
GeneralOne more ugly bug PinmemberAnonymous18-Jun-02 10:40 
GeneralRe: One more ugly bug PinmemberAnonymous23-Jun-02 18:52 
GeneralRe: One more ugly bug PinmemberKoushiro7-Jul-02 6:48 
GeneralRe: One more ugly bug PinmemberBalkrishna Talele29-Dec-03 1:13 
GeneralUgly bug PinmemberAnonymous18-Jun-02 10:36 
GeneralRe: Ugly bug Pinmemberaeropriest23-Jun-02 19:02 
GeneralRe: Ugly bug PinmemberMarcus Carey24-Mar-04 16:08 
QuestionGood job!! but,Can this port to MFC Dialog application? Pinmemberphped17-Jun-02 18:20 
AnswerRe: Good job!! but,Can this port to MFC Dialog application? PinmemberAshok Jaiswal23-Jun-02 22:27 
GeneralReally Cool !!! But ... PinmemberAnonymous17-Jun-02 13:38 
GeneralRe: Really Cool !!! But ... Pinmemberaeropriest23-Jun-02 19:06 
Generala simple solution is... Pinmembersun_tzu2-Apr-03 13:57 
GeneralVery good PinsubeditorBrian Delahunty17-Jun-02 5:59 
GeneralCool... PinmemberStefan Spenz17-Jun-02 2:25 
GeneralRe: Cool... PinsubeditorBrian Delahunty17-Jun-02 5:58 

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 | Mobile
Web03 | 2.8.140926.1 | Last Updated 17 Jun 2002
Article Copyright 2002 by Ashok Jaiswal
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid