Hi there just a quick question I hope someone can help me with I am loading a logo onto my dialog application into a static picture holder using the .rc file and adding this code.
ICON IDI_MYICON,IDC_STATIC_IMAGE,120,154,21,20
However my problem is this will only display a 64×64 image max and the banner I have loaded is 242×74 in size am I using the wrong method in using ICON? I did try bitmap but didnt work either.
Thanks
The
21,20in your statement is the width and height of the icon control in dialog units. Dialog units vary depending on things like screen DPI and the font selected. There are typically 2-4 pixels per dialog unit. You’ve basically given the icon something on the order of 64×64 to display in.To get the icon control sized pixel-perfectly, you can to resize it dynamically, e.g., during
WM_INITDIALOG.Also, I’m not sure which method the dialog box code uses to load the icon–some (like LoadIcon) restrict the size to a “standard” size which others (like LoadImage) do not.