Date: 2008sep7
Framework: MFC
Language: C/C++
Q. MFC: How do I make bitmap buttons with MFC?
A. Make the button style BS_BITMAP and BS_OWNERDRAW.
Many other instructions out there don't mention BS_OWNERDRAW --
it essential. This means it can not be a default button.
For example:
CONTROL "",IDOK,"Button",BS_OWNERDRAW | BS_BITMAP, 10,10,100,100
Import at least 2 bitmaps as resources.
IDB_OK BITMAP DISCARDABLE "res\\ok.bmp"
IDB_OK_PRESSED BITMAP DISCARDABLE "res\\ok_pressed.bmp"
The bitmaps can be more than 256 colors.
In your class declare it as CBitmapButton. Like this:
CBitmapButton m_OK;
In your InitDialog routine do:
m_OK.LoadBitmaps(IDB_OK, IDB_OK_PRESSED);
You can add more bitmaps for other states.