I have a C++ MFC MDI application. I have a tool bar with some buttons on it. I need to add some check boxes to this toolbar and i need them to have custom bitmaps just as my buttons do. Thanks
EDIT:
By bitmpas i refer to the pixel images that can be created using the tool bar editor in visual stuidos 2008. I would like a picture (of my creation) instead of the usual tick box.
You don’t use checkboxes on toolbars.
You should rather use regular buttons in Check mode. That means that the button stays pressed when user releases it. Clicking it a second time releases the button. This is the same behaviour as a checkbox.
You can either set a toolbar button as checkable by code:
Or by enabling the corresponding property in the resource editor.
If you want to modify the image displayed when the button is pressed, in your
ON_UPDATE_COMMAND_UIhandler, use m_ToolBar.GetButtonInfo() to check if the image matches the state. If not, change it usingm_ToolBar.SetButtonInfo()and specify the index of an extra image added to the image list of the toolbar.