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 General Discussion » some CExtCmdIcon methods Collapse All
Subject Author Date
Petr Maar Mar 31, 2006 - 3:11 AM

Hello,
i have found your instructions how to handle bitmapped buttons:
--------
CExtCmdIcon ico(
LoadBitmap( AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_BITMAP1) ),
RGB(255,255,255)
);
m_Btn.SetIcon( ico.DetachAsHICON() );
--------
It seems no such methods of CExtCmdIcon are presented in my Prof-UIS library (downloaded from your site), what can I do? Is it any kind of limitation?
The second problem I have is that some controls in dialog (e.g. CExtLabel ones) have their background drawn improperly when using 2003 or 2005 theme -
you can see their rectangle area which is filled with another gradient (but the theme color is ok)...

Thanks for any help.

[Prof-UIS 2.53 freeware, VS 7.1, unicode]

Fransiscus Herry Mar 17, 2007 - 3:50 AM

Dear Prof-uis........

i have applied this, but the background of my icon is still painted not in transparant mode.

thank you

Technical Support Mar 17, 2007 - 10:41 AM

Please let us know more details about your code that loads icons. The CExtCmdIcon class was completely re-coded several releases ago and now based on the four CExtBitmap objects containing images in 32-bit format with per-pixel alpha channel for normal, hovered, pressed and disabled state of the command item. This allowed us to provide Prof-UIS users with Windows Vista/XP icon quality on any Windows OS. So, if your code loads the CExtCmdIcon::m_bmpNormal bitmap object in non-32-bit format with alpha channel, then you should invoke the following code to make pixels of particular color transparent:

CExtCmdIcon * pCmdIcon = . . .
      pCmdIcon->m_bmpNormal->LoadBMP_ . . . ();
      pCmdIcon->m_bmpNormal.Make32();
      pCmdIcon->m_bmpNormal.AlphaColor( . . . );

Petr Maar Mar 31, 2006 - 4:05 AM

Ok, i know there are other methods (maybe these were removed) but not documented, why?

Second problem still persists...

Technical Support Mar 31, 2006 - 7:43 AM

Typically we update all the documentation with each major release. Prof-UIS 2.53 is a minor release. So, please wait a bit until the next major release (coming soon).

Technical Support Mar 31, 2006 - 7:37 AM

All the icon related code in Prof-UIS 2.53, including the CExtCmdIcon class, was rewritten from scratch. We are sorry for the inconvenience, but this is essential for providing the best icon quality regardless of what Windows OS your app is running on. So, please update your code snippet in this way:

CExtCmdIcon ico;
ico.AssignFromHBITMAP( 
    LoadBitmap( AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_BITMAP1) ),
    RGB(255,255,255)
    );
m_Btn.SetIcon( ico.ExtractHICON() );

You can also use the CExtBitmap class instead:
 
    CExtBitmap bmp;
    VERIFY( ico.LoadBMP_Resource( MAKEINTRESOURCE( IDB_BITMAP1 ) ) );
    bmp.AlphaColor( RGB(255,255,255), RGB(0,0,0), 0 );
    m_Btn.SetIcon( bmp.CreateHICON() );
Please let us know how to reproduce the incorrect background problem? Does this problem occur in our samples?

Petr Maar Mar 31, 2006 - 7:59 AM

Thank you for quick reply!
I have already solved the incorrect background problem - i forgot to remove OnPaint handler from my dialog class. Even with empty body, this caused the problem... Now it works perfectly...

Thank you for your help again! Great work...

Technical Support Apr 3, 2006 - 7:37 AM

When the dialog has a OnPaint handler in its message map, then Prof-UIS invokes this user defined message handler instead of its own implementation. This allows you to implement your own painting algorithm in OnPaint().