Skinned background in owner-drawn CStatic control |
Post Reply |
Author | |
UglySwede
Groupie Joined: 27 February 2013 Location: Sweden Status: Offline Points: 17 |
Post Options
Thanks(0)
Posted: 30 December 2014 at 11:12am |
We are using Codejock/MFC to skin our application. It works fine and our customers like the look! :-)
We have a problem with a new control, though. It's a bit special, so we have to owner-draw it. We create it as CStatic with the SS_OWNERDRAW flag set, and we override the DrawItem() method. The control is drawn as we want it. But we can't get the background right... Apparently, an owner-drawn CStatic does NOT automatically redraw the background. When we Invalidate() the control, it gets redrawn. But the background is not repainted, so the new value is painted above the previous. We have tried to paint the background ourselves, by handling WM_ERASEBKGND. But how do we get the right color/brush? The default brush (the brush you get with GCLP_HBRBACKGROUND) is a white brush. We want the background brush of the current Codejock skin. I'm no expert on owner-drawn controls. I'd be more than grateful for some good advice! :-) (a) Are we doing something wrong? Could we set some flag so that the background of the CStatic gets repainted just like an ordinary (non-owner-drawn) CStatic? (Ordinary CStatics are of course painted with the correct skinned Codejock background.) (b) Maybe CStatic is the wrong choise. Should we use some other type of control for our owner-drawn control? (c) Are there some way to get the background brush for the current Codejock skin? It's no problem at all for us to paint the background ourselves, but we need the correct brush. Best regards Anders from Sweden |
|
Insad
Groupie Joined: 28 October 2004 Location: The Netherlands Status: Offline Points: 55 |
Post Options
Thanks(0)
|
I have the same issue for some time now and never found a solution.
We have decided to disable skins for the time being and only use it in demos, promotion stuff, etc. until CJ finds a solution or until I have some time left over (will not happen very soon!) so I can look at it myself.. So please CodeJock can you provide an answer or solution |
|
Products in use: XTP version 13.4.2/15.3.1/16.4.0/17.3.0
Platforms: Win2003(R2)/Win2008(R2)/Win7/Win2011/Win8(.1)/Win2012(R2)/Win10 (x86/x64) Langs: VC++ (MFC) 6/2005/2008/2013/2015/2017 |
|
mcmastl
Admin Group Joined: 14 April 2015 Status: Offline Points: 79 |
Post Options
Thanks(0)
|
Hello and thank you for bringing this to our attention. We have informed the development team and will be looking into the issue. Are you able to reproduce this issue with any of our samples?
|
|
Luke McMasters, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Insad
Groupie Joined: 28 October 2004 Location: The Netherlands Status: Offline Points: 55 |
Post Options
Thanks(0)
|
I'm trying to get a sample you can use but it doesn't seem to be that easy;
If I try the Skin samples (MDI/SDI/etc) I can dynamically add CStatics to it and they all work without issues. In my case I'm using an MDI application with RibbonBar and Theming. When I add skinning the problem arises on a view in which I add controls, in a dynamic way, from a XML file onto a CXTPTabCtrl. All these controls work without color issues, with the exception of CStatic and checkboxes.. (Just found that one out, which is odd since the other CButton based controls, like radio buttons, look nice) The background of the CStatic and the checkbox always seem to be white. And when I disable skinning the background happens to be white on this CXTPTabCtrl. Currently I don't have much time but I will try to look what happens if I disable skinning and set the CXTPTabCtrl color to blue or something.. |
|
Products in use: XTP version 13.4.2/15.3.1/16.4.0/17.3.0
Platforms: Win2003(R2)/Win2008(R2)/Win7/Win2011/Win8(.1)/Win2012(R2)/Win10 (x86/x64) Langs: VC++ (MFC) 6/2005/2008/2013/2015/2017 |
|
Insad
Groupie Joined: 28 October 2004 Location: The Netherlands Status: Offline Points: 55 |
Post Options
Thanks(1)
|
Okay.. I've got it working as expected..
Some 'inexperienced' junior developer had build his own color customization in a CTXPTabCtrl derived class which eventually screwed up all kinds of things.. After removing all that stuff theming and skinning seem to work without issues. And the part for which the color customization was made also works since we can now handle that in the skins Anyway, thanks for listening * Edit: somewhat more friendly to junior developers |
|
Products in use: XTP version 13.4.2/15.3.1/16.4.0/17.3.0
Platforms: Win2003(R2)/Win2008(R2)/Win7/Win2011/Win8(.1)/Win2012(R2)/Win10 (x86/x64) Langs: VC++ (MFC) 6/2005/2008/2013/2015/2017 |
|
mcmastl
Admin Group Joined: 14 April 2015 Status: Offline Points: 79 |
Post Options
Thanks(0)
|
Hi Insad,
Im glad to hear you have resolved the issue! |
|
Luke McMasters, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |