开发者

Trouble with creating WPF window extended on the title area (like Office 2007/2010)

I want to make WPF window extended on the title area (like Office 2007/2010). I implemented DwmWindow (see DwmTest.zip) where I put required stuff. Commonly, it works fine except one disgusting thing: the window appears as white rectangle (see DwmIssue.png) and after a few second this rectangle disappears and the content of the window is shown (see DwmIssueCorrect.png). This bug is essential only for my window. If I remove this lines it works fine (without it aero will not showed on title):

HwndSource mainWindowSrc = HwndSource.FromHwnd(handle);
if (mainWindowSrc != null) mainWindowSrc.Composition开发者_如何学CTarget.BackgroundColor = Colors.Transparent; 
NativeMethods.MARGINS margins = new NativeMethods.MARGINS(0, 50, 0, 0);
NativeMethods.DwmExtendFrameIntoClientArea(handle, margins);

How can I eliminate this white rectangle?

(To run a sample DwmTest.zip WinVista/7 with DWM enabled and .NET 4.0 is required. To compile sample you will need Visual Studio 2010)


I have no direct solution to your problem, but you might want to have a look at this blog post which I have read yesterday. As far as I understood, it is about a WPF wrapper framework for the needed functionality, so that you can specify all the stuff in XAML. I have not tried it, but it seems to be from guys from Microsoft, so they probably know how to do that...

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜