CMFCButton Icon twice as big as it should be

I'm trying to put an icon on a button in MFC (VC++ 2008). To do this I use CMFCButton class for a control variable. It has SetImage method for this (code snippet  below).
The icon is displayed on the button but it is twice as big as the original. The ico file has only one icon 16x16 32bpp but it is displayed as 32x32 - you can see the pixels. They were 32x32 but I resized them to 16x16.
I tried Clean for the project, Rebuild as well. I deleted the icons from the resource and added them anew. Nothing helps.

What else can I do?
HICON hAddIcon =  pApp->LoadIcon(IDI_ADD);
 
	m_btnNowyMat.SetImage(hAddIcon);

Open in new window

LVL 7
tg_wilkAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Naveen_RCommented:
Tru using the LoadImage() function intead of LoadIcon().


HICON hIcon = (HICON)::LoadImage( AfxGetInstanceHandle(), 
                                  MAKEINTRESOURCE(IDI_ADD),
                                  IMAGE_ICON,
                                  16,16, 0 );

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tg_wilkAuthor Commented:
Worked like a charm. I wonder what was wrong with the other one.
0
Naveen_RCommented:
LoadIcon loads the icon in the size of SM_CXICON and SM_CYICON system metric values..
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Editors IDEs

From novice to tech pro — start learning today.