Click here to Skip to main content
Licence 
First Posted 16 Jun 2002
Views 249,638
Bookmarked 79 times

Customized Skinned Caption for MDI

By | 16 Jun 2002 | Article
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 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

About the Author

Ashok Jaiswal

Web Developer

Hong Kong Hong Kong

Member

innovating, managing and developing next generation media products and services

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
Questionhow to change the background of menubar and status bar PinmemberBlrBoy0:58 26 Jun '07  
Generalgod example, but many gdi leaks! (solution inside) PinmemberCodeFlatter6:02 22 Oct '05  
QuestionCan you update the code with all bugfixes Pinmembertim63522:45 10 Jul '05  
AnswerRe: Can you update the code with all bugfixes PinsussAnonymous15:20 11 Jul '05  
Generalgod job!! suggest use uskin-- another personal free skin lib Pinmemberthirdwolf17:39 26 Jun '05  
GeneralSystem Menu Pinmemberfeeeto22:30 30 Mar '05  
QuestionHow to change the color of the caption bar with win32 API Pinmembernjdibfm18:23 20 Jan '05  
GeneralChildFrame caption Cancel (X) button on PocketPC PinsussMike Landis11:37 18 Jan '05  
GeneralAnother ugly bug PinmemberYacine950005:12 29 Jul '04  
GeneralRe: Another ugly bug PinsussAnonymous19:09 31 May '05  
GeneralCDialog with a round rect PinsussAnonymous4:36 11 Jun '03  
GeneralCDialog with a round rect PinsussAnonymous4:36 11 Jun '03  
Generalreally cool PinmemberRaphael Amorim10:55 11 Feb '03  
GeneralAnother way for skinnable SDI/MDI/Dialog application Pinmemberjedyking6:31 22 Jan '03  
GeneralRe: Another way for skinnable SDI/MDI/Dialog application Pinmember-wolfy-12:15 17 Mar '03  
GeneralRe: Another way for skinnable SDI/MDI/Dialog application PinmemberCalder9:48 19 Jan '04  
GeneralRe: Another way for skinnable SDI/MDI/Dialog application PinmemberTrungHuynh21:28 1 Jun '04  
Generalalmost compiles but... Pinmemberm1k3d3s5:45 22 Jan '03  
GeneralRe: almost compiles but... PinsussAnonymous23:58 11 Feb '03  
Generalpls let me know Pinmembersaurabh_p_agashe18:53 26 Dec '02  
GeneralGod job.but.... Pinmemberxipeng20:47 10 Nov '02  
GeneralRe: God job.but.... PinsussAnonymous22:06 10 Nov '02  
GeneralRe: God job.but.... Pinmemberxipeng3:35 11 Nov '02  
GeneralMemory leaks! Pinmemberdicker23:42 18 Aug '02  
GeneralRe: Memory leaks! Pinmembersclhj2001@hotmail.com1:53 21 May '04  

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.

Permalink | Advertise | Privacy | Mobile
Web04 | 2.5.120517.1 | Last Updated 17 Jun 2002
Article Copyright 2002 by Ashok Jaiswal
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid