JiiPee
unread,Nov 26, 2016, 6:38:30 AM11/26/16You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
How to change CMFCToolBar s button image using a bitmap from the resource?
Such a simple task and I can to it with CToolbar, but the documentation
is poor and have been googling many hours and found nothing.
My current code, which does not work:
h-file:
CMFCToolBar m_toolBar;
CMFCToolBarImages m_mfcToolBarImages;
CMFCToolBarButton but;
--------------------------------
cpp-file:
CBitmap bm;
HBITMAP hBitmap = (HBITMAP) ::LoadImage(AfxGetInstanceHandle(),
MAKEINTRESOURCE(IDB_BITMAP1), IMAGE_BITMAP,
0, 0, LR_CREATEDIBSECTION | LR_LOADMAP3DCOLORS);
m_mfcToolBarImages.AddImage(hBitmap);
CMFCToolBar::SetUserImages(&m_mfcToolBarImages);
but.SetImage(0);
m_toolBar.InsertButton(but);
-----------------------------------------------------------------
SetUserImages returns true so I am supposing it was succesfull. But how
do I now link m_mfcToolBarImages with buttons so that toolbar uses those
images. Even creating a new button (InsertButton) uses the default
toolbar images so not the ones from m_mfcToolBarImages.
Thanks