Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2008 Mar : Vista Aero, drawing outside the window

www.cryer.info
Managed Newsgroup Archive

Vista Aero, drawing outside the window

Subject:Vista Aero, drawing outside the window
Posted by:"OBones" (obones_gf..@_gfz_altern.org)
Date:Mon, 10 Mar 2008 09:09:21

Hi all,

In the JVCL, we have a set of menu components that apply various styles
to the menus in your applications. One of them is the "XP" style where
menus have a white background and flat borders. Doing the white
background is quite easy with owner drawn menus but having the flat
borders is a bit trickier. Up to now, we were basically drawing on the
desktop canvas at the location where the menu is located. The canvas
handle is obtained with those calls:

GetWindowDC(GetDesktopWindow)

This works perfectly fine in all versions of Windows up to Windows XP.
However, many users have reported that the painting of this style of
menus is very very slow under Windows Vista when using the Aero theme.
After looking around, I figured out it's because of the Desktop Window
Manager which does what is called "desktop composition". This imposes a
very heavy penalty on programs drawing directly on the desktop canvas.
I understand the implications of all this and so I'm trying to find a
way to be able to draw the borders of the menu while still having
acceptable performances under Aero. I have tried getting a canvas handle
with this call:

           DC := CreateDC('DISPLAY', nil, nil, nil);

This works as well, and the performances are a bit better than the above
but still, the speed is much slower and definitely noticeable by users.
I tried looking around for solutions to this problem and while I could
find many messages of people mentioning the problem itself and its
origin, I could not find any solution. I'm quite sure I did not look
around properly and this is why I'm asking you guys here if you know a
way to achieve what I want.

Thanks in advance for your help
Regards
Olivier

Replies:

www.cryer.info
Managed Newsgroup Archive