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 » AssignFromHICON question Collapse All
Subject Author Date
Offer Har May 10, 2007 - 7:43 AM

Dear Support,

I have an icon resource that i display in a grid cell.
I use the AssignFromHICON to load the icon.

What i see is that the edges of the icon in the icon file are not smoothen in the grid cell as they are in the icon file itself.
This is the code i use:
CExtCmdIcon icon1.AssignFromHICON(
        (HICON)::LoadImage(::AfxGetInstanceHandle(),MAKEINTRESOURCE(nMyReousreID),IMAGE_ICON,16,16,0),
        false);
GridIconInsert(&icon1);

I see that you convert the icon into a bitmap - does it mean that the attributes of the icon are lost (transparency etc.)?

Regards,
Ron.

Technical Support May 10, 2007 - 11:11 AM

In the latest Prof-UIS versions, you can display images using the CExtBitmap class, which has many features including that it does not consume GDI handles. Besides the icon data cannot be lost because these images have a 32-bit format with alpha chanel. You could load some larger icon size and then manually resize it to 16x16 using an appropriate scaling algorithm:

HICON hIcon32x32 = . . .
CExtCmdIcon _icon;
      _icon.AssignFromHICON( hIcon32x32 . . .
      CExtBitmap::Filter _f( CExtBitmap::Filter::lanczos );
      _icon.m_bmpNormal.Scale( 16, 16, _f );