Professional UI Solutions
Site Map   /  Register


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 » Custom bitmaps on CExtButton instead of skin? Collapse All
Subject Author Date
Carsten Pedersen Oct 26, 2007 - 5:45 AM


I’m using the skin manager to apply the skin to my dialog application. However, there are a few buttons that I want to design myself. That is, I have the bitmaps for the In, Out, Disabled etc states. I’ve read that the CExtButton class needs to be derived in order to overload the _RenderImpl() function.
Can anyone inform me of an easy way to implement this functionality? I would like to retain the skin background on the transparent areas of the bitmap.

Best regards,

Carsten Pedersen Mar 14, 2008 - 7:13 AM

It’s been a while since I looked at this the last time. But now I at last have some time to dig into drawing of custom buttons.
I checked the CExtPaintManagerSkin::PaintPushButton method, and it doesn’t do eny painting. It passes on to the CExtPaintManager::PaintPushButton, which does the painting.
But should I then inherit the PaintPushButton method instead? I cannot copy things from PaintPushButton into _RenderImpl() -derived method, because the parameters aren’t the correct ones.

Technical Support Mar 17, 2008 - 4:00 AM

The CExtPaintManagerSkin::PaintPushButton() is a very big method which paints buttons in its unique way. It invokes its parent class only in two particular cases: color picker menu buttons and date picker buttons. These two cases are not skinned yet.

Carsten Pedersen Oct 29, 2007 - 4:53 AM

The article tha Ivan refers to, talks about overriding the CExtPmBridge::PmBridge_GetPM() .
But it might be easier overloading the _RenderImpl() method, and using the things from CExtPaintManagerSkin::PaintPushButton (background drawing etc.) that is needed.
I’ll dig into it.

Thanks alot!

Technical Support Oct 26, 2007 - 11:28 AM

We are sorry the last sentence should be:

There you can copy the code from CExtPaintManagerSkin::PaintPushButton and change that part where the background is painted.

Technical Support Oct 26, 2007 - 11:24 AM

Although the CExtButton::_RenderImpl virtual method is called for drawing the button but in fact it is drawn by the currently selected paint manager( in the CExtPaintManager::PaintPushButton virtual method where it is overridden in the corresponding paint manager classes). So you should create a CExtButton-derived class and override the _RenderImpl virtual method. There you can copy the code from CExtPaintManagerSkin::PaintPushButton and the part where the background is painted.

Ivan Surzhenko Oct 26, 2007 - 9:11 AM


It problem was revieved for XML based skins at other thread: