Skinned background in owner-drawn CStatic control
Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Controls
Forum Description: Topics Related to Codejock Controls
URL: http://forum.codejock.com/forum_posts.asp?TID=22500
Printed Date: 21 November 2024 at 9:56pm Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com
Topic: Skinned background in owner-drawn CStatic control
Posted By: UglySwede
Subject: Skinned background in owner-drawn CStatic control
Date 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
|
Replies:
Posted By: Insad
Date Posted: 18 May 2015 at 7:01am
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
|
Posted By: mcmastl
Date Posted: 18 May 2015 at 12:52pm
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
|
Posted By: Insad
Date Posted: 19 May 2015 at 9:51am
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
|
Posted By: Insad
Date Posted: 19 May 2015 at 11:10am
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
|
Posted By: mcmastl
Date Posted: 19 May 2015 at 12:00pm
Hi Insad, Im glad to hear you have resolved the issue!
------------- Luke McMasters, Support Team CODEJOCK SOFTWARE SOLUTIONS
|
|