Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

WS_EX_COMPOSITED and GDI+, again

1,038 views
Skip to first unread message

Kai Brüning

unread,
Mar 2, 2004, 5:16:06 AM3/2/04
to
Hi,

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

Rhett Gong [MSFT]

unread,
Mar 3, 2004, 3:06:03 AM3/3/04
to
Hi Kai,
From your description, you used WS_EX_COMPOSITED in your custom draw window classes. It works fine when the dialog is resized, but it does not work when
little parts of dialog are invalidated.

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.


Rhett Gong [MSFT]

unread,
Mar 4, 2004, 1:31:56 AM3/4/04
to
Hi Kai,
Due to little doc on this style, there are no more known issues on it.

However, could you send a simple repro sample to let me see if I
could do some assist on your specific problem?

Kai Brüning

unread,
Mar 5, 2004, 4:51:05 AM3/5/04
to
Hi Rhett,

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

Rhett Gong [MSFT]

unread,
Mar 8, 2004, 2:57:53 AM3/8/04
to
Hi Kai,
It seems a bug when using some GDI+ functions with
WS_EX_COMPOSITED ex style.
I will update you later after doing some research on this problem.
Thanks!

Have a nice day!

Greg Binkerd [MS]

unread,
Mar 9, 2004, 3:11:55 PM3/9/04
to
Hello, Kai.

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.


Greg Binkerd [MS]

unread,
Mar 11, 2004, 11:37:55 AM3/11/04
to

Hello, Kai.

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.

0 new messages