Skin Customization Page for the BCGControlBar Library


Desktop-as-a-Service Designed for Any Cloud ? Nutanix Frame


The BCGToolbar Library

This article is written as an extension to an excellent toolbar library written by Stas Levin. This article is written with version 5.2 of the library, but take a look at the BCGSoft website for the latest version. I will not get into how you use and install the library.

This article decribes how to add a custom page to the Customisation dialog box, which is displayed when you right click on a toolbar or menu and choose "Customize...” The sample program is based on the sample "CustomPages", which comes with the library. Parts of the code are also based on the BCGSkins sample, which demonstrate how to add skins to your application with the BCGControlBar library. I will not describe the CSkinPage class in detail, but rather describe how to use it.

Getting Started

Use an existing BCGControlBar application or create a new application using the application wizard. Copy the following files to your application directory from the sample project:
  • Macstyle.*
  • Funnystyle.*
  • MyVisualManager.*
  • SkinPage.*
Also add the necessary resources from the .RC file.

The CSkinPage Class

The page to be added is a CPropertyPage derivative called CSkinPage. It extend CPropertyPage with the methods AddSkin() and SelectSkin().
void  AddSkin(LPCSTR szName, LPCSTR szDescription, UINT nIDBitmapPreview);

Return Value



  • szName - The name of the skin as it is displayed in the list.
  • szDescription - A short description of the skin, that is displayed below the list with available skins
  • nIDBitmapPreview - A bitmap resource to be displayed as a preview when the skin is selected from the list.



Adding the Custom Page

In CMainFrame::OnViewCustomize() insert this code, that will be executed when you choose to customize the toolbars and menus.
CList  lstCustomPages;
lstCustomPages.AddTail (RUNTIME_CLASS (CSkinPage));

// Create a customize toolbars dialog:
CBCGToolbarCustomize* pDlgCust = 
 new CBCGToolbarCustomize (this, 
                           TRUE, // Automatic menus scaning
                           | BCGCUSTOMIZE_TEXT_LABELS 
                           | BCGCUSTOMIZE_LOOK_2000 
                           | BCGCUSTOMIZE_MENU_ANIMATIONS, // default parameters
                           &lstCustomPages); // ptr to custom prop pages runtime classes

pDlgCust->Create ();

// Very ugly cast!!!
CMyBCGToolbarCustomize* pTemp = (CMyBCGToolbarCustomize*)pDlgCust;

// Get a ptr to the skinpage and add some skins
CSkinPage* pSkinPage = DYNAMIC_DOWNCAST(CSkinPage, 

pSkinPage->AddSkin("Office XP", 
                   "The new Windows look", 

                   "That ol\' mac style. For people that just can't let go :-)", 

pSkinPage->AddSkin("Stas on mushrooms", 
                   "A weird and strange windows look, "
                   "that you propably won't stand for long", 

int iSelectedSkin = theApp.GetInt("ActiveSkin", 0);
This function does not do anything interesting. The index of the selected skin comes in from the WPARAM parameter and is transferred directly to the SetSkin() function in the application class. Make sure that the order in which you add the skins to the list is exactly the same as the order in which the index is handled in SetSkin() - starting from one, since the first entry always is "<no skin>".

That's it! Go ahead and try it out. If you are not familiar with the BCGControlBar library go ahead and download a copy. The library are free to use for freeware develpment, and quite inexpensive for commercial applications compared to similar libraries like the ones from Stingray and Dundas. Keep up the good work Stas!!

Please note that I'm not in any way connected to BCGSoft, other than I use the library in my daily work.

About the Author

Christian Skovdal Andersen is a co-owner of a small software company in Denmark, Europe, specialised in telephony- and windows development. He is into MFC/ATL programming, and enjoys writing an article now and then. Be sure to visit my Web site (in Danish) to see many more technical articles, code and tips.


Download demo - 139 Kb


  • This is spam !!!

    Posted by Legacy on 01/24/2004 08:00am

    Originally posted by: Tina

    I am getting sick and tired of this ****!
    If you want to promote somebody elses written stuff, which is not even open source and has NAG SCREEN then do it somewhere else!
    Some of us would actualy like to know how to do things ourselves not to pay like 600 USD.
    Then I would not come to this site in first place!


    And do it somewhere else!

  • http://www.codejock.com

    Posted by Legacy on 06/08/2003 07:00am

    Originally posted by: The Best Tools On The NET - VS.NET and Office XP/2003 GUI!


  • Why reinventing the wheel?

    Posted by Legacy on 01/17/2003 08:00am

    Originally posted by: Brasil Carnival

    The best think I've ever seen for skinning (and used since) is an ActiveX control (don't yell:-)) called ActiveSkin from www.Softshape.com.
    Bad part is that it doesn't skin the common window dialogs. If you buy a plug-in to it, SkinBoxer from http://smartbrainsoftware.com you can EVEN skin the default windows (common dialog windows like mesasgeBox, Open/Save dlg, etc). Never been able to skin those since now.
    All together, best packege ever! Yoohoo!!

  • compiling error

    Posted by Legacy on 03/14/2002 08:00am

    Originally posted by: Edgardo

    'bcgcb.h' this file is missing on your demo?

  • BCGToolBar Skin

    Posted by Legacy on 09/21/2001 07:00am

    Originally posted by: mack

    Resource leak in the download!



  • Form++ Library(With Full MFC Source Code)

    Posted by Legacy on 08/29/2001 07:00am

    Originally posted by: Steven zhang

    Form++ Library provides Microsoft Foundation Class (MFC)/Visual C++ developers with a complete library of MFC extension classes which implement a drag and drop (e.g. VC,VB Form Editor) graphical interface. These classes fill many of the holes existing in the Windows Graphics Device Interface (GDI) and allow developers to incorporate custom graphical objects and enhanced drawing capabilities into their applications. All of these classes fit seamlessly with MFC, and inherit many of MFC's existing classes. Easily give your application a new look in minutes!

  • Asserts Mushroom skin

    Posted by Legacy on 03/15/2001 08:00am

    Originally posted by: Steve Quick

    In the customize dialog, select the Mushroom skin, close the dialog and redisplay the dialog. The following asserts:

    // Function name : CSkinPage::SelectSkin
    // Description : Set the skin that is currently active
    // Return type : void - none
    // Argument : int iSkin -- index of the skin as it is used in the BCGM_NEWSKIN handler
    void CSkinPage::SelectSkin(int iSkin)
    ASSERT(iSkin < m_listSkinObj.GetCount());
    m_iSelectedSkin = iSkin;

    Change the 2nd assert to use "<=" instead of "<".

    ASSERT(iSkin <= m_listSkinObj.GetCount());

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date