Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Property Grid
  New Posts New Posts RSS Feed - PropertyGrid doesn't draw in front of Group Boxes
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

PropertyGrid doesn't draw in front of Group Boxes

 Post Reply Post Reply
Author
Message
JohnCrenshaw View Drop Down
Groupie
Groupie
Avatar

Joined: 08 September 2006
Status: Offline
Points: 65
Post Options Post Options   Thanks (0) Thanks(0)   Quote JohnCrenshaw Quote  Post ReplyReply Direct Link To This Post Topic: PropertyGrid doesn't draw in front of Group Boxes
    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
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
JohnCrenshaw View Drop Down
Groupie
Groupie
Avatar

Joined: 08 September 2006
Status: Offline
Points: 65
Post Options Post Options   Thanks (0) Thanks(0)   Quote JohnCrenshaw Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 20 February 2007 at 2:32am
Hello,
 
You started that you can't put grid to groupbox:
 
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
rmercer View Drop Down
Groupie
Groupie


Joined: 22 February 2006
Status: Offline
Points: 34
Post Options Post Options   Thanks (0) Thanks(0)   Quote rmercer Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
kstowell View Drop Down
Admin Group
Admin Group


Joined: 25 January 2003
Location: MIchigan, USA
Status: Offline
Points: 496
Post Options Post Options   Thanks (0) Thanks(0)   Quote kstowell Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
rmercer View Drop Down
Groupie
Groupie


Joined: 22 February 2006
Status: Offline
Points: 34
Post Options Post Options   Thanks (0) Thanks(0)   Quote rmercer Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.156 seconds.