开发者

MFC - How to display icon in Static Picture Control bigger than 32x32

开发者 https://www.devze.com 2023-01-20 23:51 出处:网络
I have a MFC dialog application with a picture control. I add an icon file with different size of images (32x32, 48x48, etc...) into the icon resource. Then I set the following picture control propert

I have a MFC dialog application with a picture control. I add an icon file with different size of images (32x32, 48x48, etc...) into the icon resource. Then I set the following picture control properties:

Type - Icon Real Size Image - True

I have the following code under OnInitDialog():

HICON hIcon = (HICON) LoadImage( AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_PONCAD),IMAGE_ICON, 48, 48, LR_DEFAULTCOLOR ); 
m_Icon1.SetIcon( hIcon );

The icon did get displayed but the probl开发者_StackOverflowem is that the icon is cropped off. I think the total display windows is still 32x32. So part of the icon is missing.

How to get the icon displays in size 48x48 properly?

Thank you.


Use DrawIconEx win32 API and it should be called when ever window redrawn/moved or resized.

For more help go through the below link

ms-help://MS.MSDNQTR.v90.en/winui/winui/windowsuserinterface/resources/icons/iconreference/iconfunctions/drawiconex.htm

0

精彩评论

暂无评论...
验证码 换一张
取 消