Skin Customization Page for the BCGControlBar Library
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.*
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
NoneParameters
- 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.
Remarks
NoneAdding 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_MENU_SHADOWS | 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, pTemp->GetCustomPageList()->GetHead()); pSkinPage->AddSkin("Office XP", "The new Windows look", IDB_PREVIEW2); pSkinPage->AddSkin("Mac", "That ol\' mac style. For people that just can't let go :-)", IDB_PREVIEW1); pSkinPage->AddSkin("Stas on mushrooms", "A weird and strange windows look, " "that you propably won't stand for long", IDB_PREVIEW3); int iSelectedSkin = theApp.GetInt("ActiveSkin", 0); pSkinPage->SelectSkin(iSelectedSkin);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.

Comments
This is spam !!!
Posted by Legacy on 01/24/2004 12:00amOriginally 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!
FOR ME....THIS IS SPAM!
And do it somewhere else!
Replyhttp://www.codejock.com
Posted by Legacy on 06/08/2003 12:00amOriginally posted by: The Best Tools On The NET - VS.NET and Office XP/2003 GUI!
http://www.codejock.com
Reply
Why reinventing the wheel?
Posted by Legacy on 01/17/2003 12:00amOriginally 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.
ReplyBad 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 12:00amOriginally posted by: Edgardo
'bcgcb.h' this file is missing on your demo?
ReplyBCGToolBar Skin
Posted by Legacy on 09/21/2001 12:00amOriginally posted by: mack
Resource leak in the download!
Help
Thanks,
ReplyForm++ Library(With Full MFC Source Code)
Posted by Legacy on 08/29/2001 12:00amOriginally 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!
Replyhttp://www.ucancode.net
Asserts Mushroom skin
Posted by Legacy on 03/15/2001 12:00amOriginally 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>=0);
ASSERT(iSkin < m_listSkinObj.GetCount());
m_iSelectedSkin = iSkin;
}
Change the 2nd assert to use "<=" instead of "<".
ASSERT(iSkin <= m_listSkinObj.GetCount());
Reply