开发者

Window positioning with Aero Themes (shadows) on - Window at 0,0 has some of the border hidden

I am opening a window at 0,0. When Aero and window shadow are disabled, this works just fine. If window shadow is enabled, part of the window's border (and title) are hidden above the upper / left of left edge of the desktop.

Is there a way to detect if the shadow is on and by how many pixels do I need to adjust the window position?

I've tried pretty much everything ava开发者_C百科ilable from GetSystemMetrics() and none of it makes sense.


Aero lies about the window position. This is a heavy duty app-compat feature, windows borders have had the same width for a very long time. That was not sustainable, at Vista time it was getting important to not make a window border one pixel wide. Monitor technology moved on, having a 1600 x 900 resolution display (my laptop) is not extraordinary. Moving the mouse cursor on my pad to hit that one pixel to make the window wider most certainly is.

So a big design goal in Vista was to create windows with nice fat borders. Easy to hit on my mouse pad.

That created a nasty app compat problem though, there's a lot of software that creates a window with CreateWindows/Ex() that specifies the outside size of the window. Client area plus borders. Having fat borders is now a problem, it doesn't make the window bigger, it makes the client area smaller. Not good, the client area is the one that counts when you fill a window with content and/or controls. There are a gazillion programs out there that expect to have a certain size client area from a given outside window size. Clipped controls and scrollbars (if you're lucky) will be rampant.

The only reasonable thing the Vista programmers could do is preserve the client size and extend the window past its requested borders. Without the app asking for it. And having to fake it when the app does ask for it, GetClientRect() call.

Fixing this behavior is possible, you have to tell Vista that you are aware of its behavior. Unfortunately that's not available from the C++ project settings. You have to run editbin.exe /subsystem to tell you're compatible with 6,0 in a post build event. Side effect is that it won't run on XP and earlier anymore. That it is not a manifest option is very, very sloppy.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜