Click here to Skip to main content
11,712,126 members (77,806 online)
Click here to Skip to main content

Customized Skinned Caption for MDI

, 16 Jun 2002 278.9K 4.4K 81
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

You may also be interested in...

Comments and Discussions

 
Questionhow to change the background of menubar and status bar Pin
BlrBoy26-Jun-07 0:58
memberBlrBoy26-Jun-07 0:58 
Generalgod example, but many gdi leaks! (solution inside) Pin
CodeFlatter22-Oct-05 6:02
memberCodeFlatter22-Oct-05 6:02 
QuestionCan you update the code with all bugfixes Pin
tim63510-Jul-05 22:45
membertim63510-Jul-05 22:45 
AnswerRe: Can you update the code with all bugfixes Pin
Anonymous11-Jul-05 15:20
sussAnonymous11-Jul-05 15:20 
Generalgod job!! suggest use uskin-- another personal free skin lib Pin
thirdwolf26-Jun-05 17:39
memberthirdwolf26-Jun-05 17:39 
GeneralSystem Menu Pin
feeeto30-Mar-05 22:30
memberfeeeto30-Mar-05 22:30 
QuestionHow to change the color of the caption bar with win32 API Pin
njdibfm20-Jan-05 18:23
membernjdibfm20-Jan-05 18:23 
GeneralChildFrame caption Cancel (X) button on PocketPC Pin
Mike Landis18-Jan-05 11:37
sussMike Landis18-Jan-05 11:37 
GeneralAnother ugly bug Pin
Yacine9500029-Jul-04 5:12
memberYacine9500029-Jul-04 5:12 
GeneralRe: Another ugly bug Pin
Anonymous31-May-05 19:09
sussAnonymous31-May-05 19:09 
GeneralCDialog with a round rect Pin
Anonymous11-Jun-03 4:36
sussAnonymous11-Jun-03 4:36 
GeneralCDialog with a round rect Pin
Anonymous11-Jun-03 4:36
sussAnonymous11-Jun-03 4:36 
Generalreally cool Pin
Raphael Amorim11-Feb-03 10:55
memberRaphael Amorim11-Feb-03 10:55 
GeneralAnother way for skinnable SDI/MDI/Dialog application Pin
jedyking22-Jan-03 6:31
memberjedyking22-Jan-03 6:31 
GeneralRe: Another way for skinnable SDI/MDI/Dialog application Pin
-wolfy-17-Mar-03 12:15
member-wolfy-17-Mar-03 12:15 
GeneralRe: Another way for skinnable SDI/MDI/Dialog application Pin
Calder19-Jan-04 9:48
memberCalder19-Jan-04 9:48 
GeneralRe: Another way for skinnable SDI/MDI/Dialog application Pin
TrungHuynh1-Jun-04 21:28
memberTrungHuynh1-Jun-04 21:28 
Generalalmost compiles but... Pin
m1k3d3s22-Jan-03 5:45
memberm1k3d3s22-Jan-03 5:45 
GeneralRe: almost compiles but... Pin
Anonymous11-Feb-03 23:58
sussAnonymous11-Feb-03 23:58 
Generalpls let me know Pin
saurabh_p_agashe26-Dec-02 18:53
membersaurabh_p_agashe26-Dec-02 18:53 
GeneralGod job.but.... Pin
xipeng10-Nov-02 20:47
memberxipeng10-Nov-02 20:47 
GeneralRe: God job.but.... Pin
Anonymous10-Nov-02 22:06
sussAnonymous10-Nov-02 22:06 
GeneralRe: God job.but.... Pin
xipeng11-Nov-02 3:35
memberxipeng11-Nov-02 3:35 
GeneralMemory leaks! Pin
dicker18-Aug-02 23:42
memberdicker18-Aug-02 23:42 
GeneralRe: Memory leaks! Pin
sclhj2001@hotmail.com21-May-04 1:53
membersclhj2001@hotmail.com21-May-04 1:53 
GeneralSize and XP Pin
Anonymous26-Jun-02 6:28
memberAnonymous26-Jun-02 6:28 
GeneralRe: Size and XP Pin
Koushiro7-Jul-02 6:51
memberKoushiro7-Jul-02 6:51 
GeneralRe: Size and XP Pin
Balkrishna Talele29-Dec-03 1:06
memberBalkrishna Talele29-Dec-03 1:06 
GeneralOne more ugly bug Pin
Anonymous18-Jun-02 10:40
memberAnonymous18-Jun-02 10:40 
GeneralRe: One more ugly bug Pin
Anonymous23-Jun-02 18:52
memberAnonymous23-Jun-02 18:52 
GeneralRe: One more ugly bug Pin
Koushiro7-Jul-02 6:48
memberKoushiro7-Jul-02 6:48 
GeneralRe: One more ugly bug Pin
Balkrishna Talele29-Dec-03 1:13
memberBalkrishna Talele29-Dec-03 1:13 
GeneralUgly bug Pin
Anonymous18-Jun-02 10:36
memberAnonymous18-Jun-02 10:36 
GeneralRe: Ugly bug Pin
aeropriest23-Jun-02 19:02
memberaeropriest23-Jun-02 19:02 
GeneralRe: Ugly bug Pin
Marcus Carey24-Mar-04 16:08
memberMarcus Carey24-Mar-04 16:08 
QuestionGood job!! but,Can this port to MFC Dialog application? Pin
phped17-Jun-02 18:20
memberphped17-Jun-02 18:20 
AnswerRe: Good job!! but,Can this port to MFC Dialog application? Pin
Ashok Jaiswal23-Jun-02 22:27
memberAshok Jaiswal23-Jun-02 22:27 
GeneralReally Cool !!! But ... Pin
Anonymous17-Jun-02 13:38
memberAnonymous17-Jun-02 13:38 
GeneralRe: Really Cool !!! But ... Pin
aeropriest23-Jun-02 19:06
memberaeropriest23-Jun-02 19:06 
Generala simple solution is... Pin
sun_tzu2-Apr-03 13:57
membersun_tzu2-Apr-03 13:57 
GeneralVery good Pin
Brian Delahunty17-Jun-02 5:59
subeditorBrian Delahunty17-Jun-02 5:59 
GeneralCool... Pin
Stefan Spenz17-Jun-02 2:25
memberStefan Spenz17-Jun-02 2:25 
GeneralRe: Cool... Pin
Brian Delahunty17-Jun-02 5:58
subeditorBrian 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 | Terms of Use | Mobile
Web02 | 2.8.150819.1 | Last Updated 17 Jun 2002
Article Copyright 2002 by Ashok Jaiswal
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid