Link to home
Start Free TrialLog in
Avatar of Alex7777qq
Alex7777qq

asked on

Can not add bitmap image as background in C++ MFC button control

Hello,

I can not add a bitmap as background on a Button Control in C++, MFC. I am using Visual Studio 2005.
I have set the button property "Bitmap" to true, and I am using the code below in
BOOL Ceduinst5Dlg::OnInitDialog(), but the button stil does not have the bitmap as a background.
I have tried adding the same code to BN_CLICKED event, then calling Invalidate(), but it again does not work.
What can I do to solve this problem?

Thanks,
Alex
CButton *pWnd = (CButton *) Ceduinst5Dlg::GetDlgItem(IDC_BUTTON1);
pWnd->SetBitmap(::LoadBitmap(NULL, MAKEINTRESOURCE(IDB_BITMAP1)));

Open in new window

SOLUTION
Avatar of imladris
imladris
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Avatar of Deepu Abraham
Deepu Abraham
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial