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 » Background on CExtButton Collapse All
Subject Author Date
Charles Bisbee Dec 29, 2010 - 2:09 AM

I have a class that was previously derived from CButton.  Its job is to paint a png file.  It works in non Prof UIS application.  I need to use it in Prof UIS application.  I changed it’s base class to CExtButton from CButton.  When it paints the bitmap from png file paints correctly but the background it paints over is the desktop rather than that of the parent window.  The parent window is derived from

CExtResizableDialog which is skinned and uses a gradient background.  I want by the transparency in the bitmap to show the parent background not the desktop background


The code used to write the bitmap is



void


{


CDC dc;


 


{


dc.Attach(lpDrawItemStruct->hDC);


CPngButton::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)if(m_bPngBitmapLoaded)//Get device context object

Gdiplus::Graphics graphics(dc);


graphics.DrawImage(m_PngBitMap, 0, 0);


}


 


 


}


 


Perhaps this is not the most ProfUIS compliant approach and I am willing to change it I just need this to work and need it to work soon.


 


So how to get the transparent area of the bitmap to draw show the area of the parent (gradient skinned background) rather than the desktop.


 


Please help


Thanks


 


Technical Support Dec 30, 2010 - 12:38 PM

The CExtIconButton class is a CExtButton-based control displaying a bitmap (CExtIconButton::m_icon::m_bmpNormal). You can also use CExtLabel control to display your PNG bitmap (CExtLabel::SetBitmapEx()). Both controls render the CExtBitmap extended bitmap into the Win32 device context surface. The CExtBitmap class is a non CBitmap-based bitmap object which supports per-pixel PNG transparency on any Windows OS including old Windows 95 and NT 4.0. But the CExtBitmap class does not contain PNG loading code. You can use the CExtSkinBitmap class from the ProfSkin library for loading PNG images.