Print Page | Close Window

PropertyGrid doesn't draw in front of Group Boxes

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Property Grid
Forum Description: Topics Related to Codejock Property Grid
URL: http://forum.codejock.com/forum_posts.asp?TID=6444
Printed Date: 21 November 2024 at 5:33pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: PropertyGrid doesn't draw in front of Group Boxes
Posted By: JohnCrenshaw
Subject: PropertyGrid doesn't draw in front of Group Boxes
Date Posted: 17 February 2007 at 1:21am
I can't believe nobody saw this yet! I had a PropertyGrid inside a group box and I couldn't see it, but I could prove it was there. On a hunch, I moved the control a bit inside the sample and lookie what I can do!
 
 
Gotta love how those "look like they should be transparent" controls are really not. Better than fixing whatever causes this to draw wrong might be to just use some of the skin framework to make the groupbox draw right. Yes, I know that the Microsoft drawing behavior makes this control opaque, but it is a fair bet that nobody takes advantage of that fact for anything useful since it would be so ugly. Anyway, My regrets to the poor developer that has to handle this bug, no adjustments to any styles I tried helped a thing. In the mean time, I have a REAL transparent groupbox class that I'll use for a workaround.
 
John



Replies:
Posted By: Oleg
Date Posted: 17 February 2007 at 2:57am
Hi,
I sure it is ZOrder thing in your application. Call grid.SetWindowPos(&CWnd::hwndTop...) to move PropertyGrid above GroupBox.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: JohnCrenshaw
Date Posted: 19 February 2007 at 11:56am
No such luck. I added the following line to the sample app, which I used for the screenshot:
 
m_wndPropertyGrid.SetWindowPos(&CWnd::wndTop, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
 
Still have exactly the same problem. The fact is, this window was created after everything else and so would be placed at the end of the Z-Order anyway. It has always recieved messages and input as if it were the top window, but all sibling windows obscure it. I have tried making sure that the clip siblings style is not set, same result.
 
This is super easy to reproduce. Just open the sample application, and resize the frame control in the dialog editor.


Posted By: Oleg
Date Posted: 20 February 2007 at 2:32am
Hello,
 
You started that you can't put grid to groupbox:
 


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: rmercer
Date Posted: 20 February 2007 at 9:57am
Originally posted by JohnCrenshaw JohnCrenshaw wrote:

I can't believe nobody saw this yet! I had a PropertyGrid inside a group box and I couldn't see it, but I could prove it was there. On a hunch, I moved the control a bit inside the sample and  ..snip..Yes, I know that the Microsoft drawing behavior makes this control opaque, but it is a fair bet that nobody takes advantage of that fact for anything useful since it would be so ugly. Anyway, My regrets to the poor developer that has to handle this bug, no adjustments to any styles I tried helped a thing. In the mean time, I have a REAL transparent groupbox class that I'll use for a workaround.
 
John
Well, I started off reading this and totally missed your point as I believe Oleg did too.  But after reviewing the example and it would seem that what you're trying to say is the entire background of the groupbox control is being erased with the background color rather than just the standard margin around the edges, with the center essentially being transparent.
 
The issue appears to be caused by the use of CXTResizeDialog.  I use the class and frankly, I've never noticed this issue until you brought it up.
 
Standard CDialog groupbox drawing behavior:
 
 
CXTResizeDialog groupbox drawing behavior:
 
 
Is this what you're talking about?  To reproduce I created a new dialog and overrode OnEraseBkgnd to paint the entire window red.  The first image is with CDialog, the second is with CXTResizeDialog.


Posted By: kstowell
Date Posted: 20 February 2007 at 4:37pm
Hello,
 
In the sample replace CXTResizeGroupBox with CButton in the PropertyGridDlg.h header. This will cause the Group Box to render transparent because CXTResizeDialog automatically sets the transparency for Group Boxes that are derived from CButton.
 
Result of using CButton for group box:
 
 
You will now notice that the group box will flicker some when you resize the dialog. If you want to use CXTResizeGroupBox then you should also call SetFlag(xtResizeNoTransparentGroup); in InitDialog to prevent the base class from setting the transparency flag (The sample overlooks this function call).
 
The purpose of CXResizeGroupBox is to reduce flicker when the group box is resized, however it only simulates transparency by painting the background and does not actually draw transparent, so in this case if you want the grid to be visible under the group box I would suggest using CButton instead.
 
Hope this helps. 
 
Regards,
Kirk Stowell


Posted By: rmercer
Date Posted: 21 February 2007 at 9:55am
Originally posted by Support Support wrote:

Hello,
 
..snip.. 
 The purpose of CXResizeGroupBox is to reduce flicker when the group box is resized, however it only simulates transparency by painting the background and does not actually draw transparent, so in this case if you want the grid to be visible under the group box I would suggest using CButton instead.
 
Hope this helps. 
 
Regards,
Kirk Stowell
Works for me.  I don't have a problem with it painting the background of the group box, and had never even noticed this until the poster brought it up.  I'd only have an issue if I was trying to render a gradient background for the entire window, but I don't do that in any of my applications.  I was just trying to help clarify the original issue reported.
 
Thanks for the excellent library.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net