Here is how to create a toolbar with buttons of custom size.
1) create two toolbar resources, the first one with 72x48 icons and the second with 43x32 icons;
2) update the command manager from both toolbar resources:
g_CmdManager->UpdateFromToolBar( strCommandProfileName, ID_TOOLBAR_WITH_72x48_ICONS );
g_CmdManager->UpdateFromToolBar( strCommandProfileName, ID_TOOLBAR_WITH_43x32_ICONS );
3) create a toolbar and assign an array of commands with icons of different size:
UINT arrCommandIDs[] = { ID_CMD1, ID_CMD2, ID_CMD3, };
pToolBar->Create( . . . )
pToolBar->SetButtons( arrCommandIDs, sizeof(arrCommandIDs)/sizeof(arrCommandIDs[0]) );
pToolBar->InitContentExpandButton();
The
CExtToolControlBar::SetButtons()
and
CExtToolControlBar::InitContentExpandButton()
methods are used here instead of the
CExtToolControlBar::LoadToolBar()
method. Please note, the
arrCommandIDs
array should contain command identifiers which are used in toolbar resources.
As a result, you will get the
CExtToolControlBar
window buttons centered vertically when the toolbar is docked horizontally or floating. The buttons will be centered horizontally when the toolbar is docked vertically.