PropertyGrid doesn't draw in front of Group Boxes |
Post Reply |
Author | |
JohnCrenshaw
Groupie Joined: 08 September 2006 Status: Offline Points: 65 |
Post Options
Thanks(0)
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
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
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 |
|
JohnCrenshaw
Groupie Joined: 08 September 2006 Status: Offline Points: 65 |
Post Options
Thanks(0)
|
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.
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hello,
You started that you can't put grid to groupbox:
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
rmercer
Groupie Joined: 22 February 2006 Status: Offline Points: 34 |
Post Options
Thanks(0)
|
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.
|
|
kstowell
Admin Group Joined: 25 January 2003 Location: MIchigan, USA Status: Offline Points: 496 |
Post Options
Thanks(0)
|
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
|
|
rmercer
Groupie Joined: 22 February 2006 Status: Offline Points: 34 |
Post Options
Thanks(0)
|
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.
|
|
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 |