Copyright © 2008-2018, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.
Date: 2008sep7 Framework: MFC Language: C/C++ Q. 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,100Import 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.
Add a commentSign in to add a comment