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 » Icons in ToolBars and Menu - Invisible background Collapse All
Subject Author Date
Suhai Gyorgy Feb 24, 2006 - 7:10 AM

Dear Support,

I have our application installed on 4 different PCs, all with Windows XP OS. In two of the cases the application looks fine but on the other two PCs the icons in the application’s toolbars and popup menus have gray background instead of invisible. Is there a Windows setting that would affect this behaviour?

Thank you,
Chris

Technical Support Feb 26, 2006 - 11:29 AM

We have just fixed a bug (in Prof-UIS 2.52) related to an invalid non-transparent background when running the app on a desktop with 15 or 16 bit color mode. We can provide you with this source code update. Besides, Prof-UIS 2.53 features the completely renewed CExtCmdIcon class (in fact, it is rewritten from scratch). There no more HICON handles used in it. The new icon is based on a PNG-like bitmap with alpha channel and features the Windows Vista/XP icon quality on any Windows OS starting from 95 and NT4.

Mark Walsen Mar 15, 2006 - 10:26 AM

I’m using the new CExtCmdIcon class in 2.5.3. The clrTransparent parameter for CExtCmdIcon::AssignFromHBITMAP isn’t quite working for me. The icon prepares the transparent background without regard to a background that I’ve painted with a gradient.

The CExtCmdIcon, which is the m_icon member of a CExtButton, is drawn on top of a CExtResizableDialog. The CExtResizableDialog handles WM_ERASEBKGND by calling CExtPaintManagerOffice2003::OnPaintToolBarGradient. I expect that the transparent portion of the icon will show through to the gradient background. Instead, the icon shows through to a solid blue background. The clrTransparent RGB(192,192,192) is correctly replaced, but incorrectly replaced with the solid blue instead of gradient background.

I tried postponing the call to CExtCmdIcon::AssignFromHBITMAP until the parent CExtResizableDialog’s first WM_PAINT, after the gradient background is painted by WM_ERASEBKGND, but that doesn’t work. It doesn’t surprise me that this doesn’t work, because I doubt that CExtCmdIcon::AssignFromHBITMAP is copying pixels from the screen to fill in the transparent pixels for the cached CExtCmdIcon bitmap.

Can you recommend a way for me to get the CExtButton’s CExtCmdIcon to apply the transparency to the gradient background drawn by the parent CExtResizableDialog’s WM_ERASEBKGND handler?

Cheers
-- Mark

Technical Support Mar 15, 2006 - 12:07 PM

The problem is that you are using the WM_ERASEBKGND message which should not be used at all if you want to avoid flickering. Why don’t you use WM_PAINT instead? You will never have any invalid background anywhere. The visual appearance of the CExtResizableDialog class is implemented in the CExtWS template class. Both messages are handled in the CExtWS::WindowProc() virtual method which looks up the message map tables for presence of the WM_PAINT and WM_ERASEBKGND handler methods. This is done to allow you to implement a custom background in resizable dialogs. But we strongly recommend you check your CExtResizableDialog-derived classes and remove all the OnPaint() and OnEraseBkgnd() handler methods from them. We think it is these methods that cause an invalid icon background in your dialog.

Suhai Gyorgy Feb 26, 2006 - 3:05 PM

Great! Thank you!