The CBitmapButton MFC class makes it easy to create buttons with custom
bitmaps. It is easy to use if you know how to. The documentation says to use
CBitmapButton::AutoLoad but I do not understand how to use it. The following is
what worked for me.
- Set the "Owner draw" style for the button on
- Use the ClassWizard to create a class derived from CButton
- In the header of the derived class change the class from CButton to
CBitmapButton
- Use ClassWizard again to create a "control category" member
variable for the button; ensure that the class is the derived class you just
created
- In the dialog's OnInitDialog use CBitmapButton::LoadBitmaps to load one or
more bitmaps
An example of LoadBitmaps is:
if (!m_ctlPictureButton1.LoadBitmaps(_T("IMAGE1UP"), _T("IMAGE1DOWN"), _T("IMAGE1FOCUS")))
MessageBox("Button1 pictures are not loaded");