Clark Smalls
Clark Smalls

Reputation: 35

Icon size help WINAPI only showing small c

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 64x64 image max and the banner I have loaded is 242x74 in size am I using the wrong method in using ICON? I did try bitmap but didnt work either.

Thanks

Upvotes: 1

Views: 308

Answers (1)

Adrian McCarthy
Adrian McCarthy

Reputation: 47954

The 21,20 in 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 64x64 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.

Upvotes: 1

Related Questions