Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Coding help for loading custom icons into toolbar

justmeherejustmehere Member Posts: 4
I am using Visual C++ 6.0 and MFC in a Dialog based project. All I want to is to be able to load custom icons which are all (3 of them) imported into the resource section of the project onto a Toolbar which has been created. Right now the Toolbar loads the default bitmap which is also located in the resource portion of the project. One further note is that I wish to load custom icons which are 72x72 pixels in dimensions. Another words I want large buttons showing up on the Toolbar. All the code is called from the OnInitDialog() function. My code unfortunately does not work.

if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_wndToolBar.LoadToolBar(IDR_TOOLBAR1))
{

TRACE0("Failed to create toolbar
");
return -1; // fail to create
}

list.Create(72, 72, ILC_COLOR32|ILC_MASK, 3, 0);
list.Add(AfxGetApp()->LoadIcon(IDI_ICON2));
list.Add(AfxGetApp()->LoadIcon(IDI_ICON2));
list.Add(AfxGetApp()->LoadIcon(IDI_ICON2));
//list.Add(&bmp, RGB(192,192,192)); //192,192,192 is the mask color

m_wndToolBar.GetToolBarCtrl().SetImageList(&list);

Sign In or Register to comment.