I am trying to use the Win XP-only WS_EX_COMPOSITED in some dialogs. It works quite nice, dialog resize becomes smooth and flicker free.
The problem is with some custom window classes which do their own drawing in WM_PAINT using GDI+. The redraw of these windows works when the dialog is resized, but not during the initial show and not if only parts of the dialog are invalidated for repaint. Actually, a little part of the drawing does always show up: the hiliting. So far I have no idea what differentiaties this drawing from all other drawing.
Are any incompatibilites between WS_EX_COMPOSITED, custom window classes and/or GDI+ known?
Best regards,
Kai
The WS_EX_COMPOSITED style will direct the Window Manager to paint all descenants of the composited window from bottom to top, thus allowing child
window transparency / translucency. All the drawing by the composited window and its descendants is double-buffered, with the final result copied to the
screen. And I find that it has the same value (0x02000000L) as WS_CLIPCHILDREN.
What we could get from doc is "it cannot be used if the window has a class style of either CS_OWNDC or CS_CLASSDC."
From some further search on this ex style, it appears to be a serious bug with using it on a dialog that contains listview control that is in report mode.
That is all I could find from the little bit of documentation on this extended style. Thanks.
Have a nice day!
Rhett Gong [MSFT]
Microsoft Online Partner Support
This posting is provided "AS IS" with no warranties, and confers no rights.
Please reply to newsgroups only. Thanks.
However, could you send a simple repro sample to let me see if I
could do some assist on your specific problem?
sorry for the late answer, but I had some problems positing here and I did further investigate the problem.
Under http://download.ragtime.de/nonpub/GDIPlusTest.zip I put a small MFC-project which demonstrates the problem.
The main window of this app is set to use WS_EX_COMPOSITED. The contents of the window is drawn using GDI+. When you start the app, only a filled rectangle becomes visible (drawn with Graphics::FillRectangle). Resize the window to see a lot more drawing (using Graphics::DrawLine and Graphics::DrawRectangle). Change the visibility of the status bar via menu command, and you will see only the filled rectangle again.
It seems that most GDI+ drawing does not work on this sense. The only functions which work seem to be fills.
I am testing under Windows XP Professional with Service Pack 1.
Note: I created this project originally to experiment with GDI+, that is the reason for the seemingly arbitrary drawing it does.
Best regards,
Kai
Have a nice day!
I have downloaded your test application and will be looking into this issue
for you. If you have anything to add, let me know.
Thanks,
-Greg
Microsoft Developer Support
This posting is provided "AS IS" with no warranties, and confers no rights.
Visit http://www.microsoft.com/security for current information on security.
I have seen several painting bugs reported with this XP only style,
WS_EX_COMPOSITED. Things can get tricky when double buffering is used and
all painting needs to be done in WM_PAINT. For example, you would not be
able to draw on a WS_EX_COMPOSITED window by calling GetDC and then
drawing on that HDC. I tested standard GDI calls inside your OnDraw and
they worked fine. As a workaround, you should create a DIB section HBITMAP
(or you could try a standard HBITMAP) in memory and select it into an HDC.
Look at ::CreateCompatibleBitmap and ::CreateCompatibleDC and also
::SelectObject. Make sure to create the HBITMAP the size of the client
window. Now, use this "memory" HDC when calling:
Graphics graphics (pDC->m_hDC);
When GDI+ is finished drawing to the memory HDC, then call BitBlt to draw
the image on the pDC.
Hope this helps.
Thanks,
-Greg
Microsoft Developer Support
This posting is provided "AS IS" with no warranties, and confers no rights.