Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » Multilayered icon support in CExtCmdIcon Collapse All
Subject Author Date
Juri Tsjornoi Jul 6, 2007 - 12:22 AM

I have an icon with multiple layers (in my case it’s 8 - 16x16, 32x32 with 16 colors to 32 bit foreach). I create a CExtCmdIcon object. Use function CreateFromHICON with my icon passed as a parameter. Later I extract an HICON handler from CExtCmdIcon object using ExtractHICON function to insert it to CImageList. Image list is created to contain small icons (16x16) and when displayed it has resized versions of 32x32 icons. Is there a way to use the desired icon layer (in this case it’s 16x16)?

Technical Support Jul 6, 2007 - 7:01 AM

The problem is not with the CExtCmdIcon class. The HICON icon is a container for one icon only. So you should load the icon of the needed size before attaching it to the CExtCmdIcon. Do not use the LoadIcon() method, because it can only load an icon whose size conforms to the SM_CXICON and SM_CYICON system metric values. You should use the LoadImage method instead so you can specify the width and height of the icon you want to load.

Suhai Gyorgy Jul 6, 2007 - 6:42 AM

A HICON handle refers to one layer of the .ico file only. How do you create the HICON you use when creating the CExtCmdIcon object?
My experience is that no Windows API can create a valid handle of a 32 bit layer (one with alpha channel).
And I think you meant AssignFromHICON instead of CreateFromHICON, right?