2012-03-05 75 views
2

我定義的新WPF應用程序項目兩個窗口:ResizeMode性能的關係XP

<Window x:Class="WpfWindowSizeLocationDifferenceXP7.Window1" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    Title="Window1" 
    Left="100" Top="100" Height="200" Width="200" 
    ResizeMode="CanResize"/> 

<Window x:Class="WpfWindowSizeLocationDifferenceXP7.Window2" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    Title="Window2" 
    Left="300" Top="100" Height="200" Width="200" 
    ResizeMode="NoResize"/> 

正如你所看到的,窗戶是站在並排側和唯一的區別在於ResizeMode屬性值。第二個窗口意味着不可調整大小。 Windows XP中的結果與Windows 7中的結果大不相同。

對不起。作爲新用戶,我無法發佈圖片,因此這裏有明確的鏈接。

的Windows XP(預期結果):http://s9.postimage.org/qrojbckil/Wpf_Window_Size_Location_XP.jpg

的Windows 7(意想不到的結果):http://s16.postimage.org/6nmyc6b79/Wpf_Window_Size_Location_7.png

的區別是什麼原因?如何處理它,所以可以依靠WPF窗口的位置和大小屬性?

+0

我來的結論,即該效果的原因是延伸的框架的DWM特徵。即使WinAPI GetWindowRect函數也有問題。需要深入探究問題。可能是WPF Shell集成庫已經有了可以使用的解決方法。 – frtnum 2012-03-05 11:42:51

回答