Bitmap on a CButton

joeslow
joeslow used Ask the Experts™
on
I have a CButton that I want a bitmap on.

CBitmap m_bmpMyBitmap;
CButton m_btnMyButton;

m_bmpMyBitmap.LoadBitmap(IDB_BITMAP1);
m_btnMyButton.SetBitmap(m_bmpMyBitmap);

This works fine until I disable the button:

m_btnMyButton.EnableWindow(false);

The button now just has a gray square where the bitmap should be.
I want it to be a "disabled" looking picture.
The bitmap was drawn 16x16 and the background was light gray (same as a button).
If the background was filled white, disabled looks good but enabled shows white on the button.

What do I need to do?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
If you can use a CBitmapButton, you can create several bitmaps which correspond to the different states that the button can
take.

If you need to make a dialog button a CBitmapButton you can use the SubclassDlgItem function in CDialog.

Author

Commented:
I followed the example in the MFC help on CBitButton and was able to get a button on a dialog, but how do you control the exact size and placement of the button?

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial