正如我在「Windows Aero Glass background is broken after hibernate. How can I solve this?」中所述,我正在使用氣動玻璃作爲背景來構建窗體。該窗口已設置ResizeMode="NoResize" SizeToContent="WidthAndHeight"
。調整後的空氣玻璃上的控制模糊
有一個網格,有一些固定的列和一個帶有元素的可變列。該元素設置爲可見並摺疊。我的窗戶應該自我膨脹和收縮,完美的作品。
我的問題是,在rezising之後,所有控件都會在每個維度上模糊大約1個像素。通過將元素可視化地重新生成以前的尺寸後,該模糊消失。我已經知道,它每次出現窗口時都會被程序調整大小。如果用戶調整了大小(只有在沒有ResizeMode="NoResize"
的情況下),則控件保持清晰。
SnapsToDevicePixels="True"
似乎對此行爲沒有影響。
如果Aero Glass被禁用,那麼所有功能都可以正常工作並保持清晰。
我期待收到您的建議。
預先感謝您。
編輯:
例子:
XAML:
<Window x:Class="glass_sample.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="SampleWindow"
ResizeMode="NoResize"
SizeToContent="WidthAndHeight"
Loaded="Window_Loaded"
Background="{StaticResource {x:Static SystemColors.ActiveCaptionBrushKey}}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="80" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Button Content="Toggle"
Click="Button_Click" />
<Button IsEnabled="False"
Grid.Column="1"
Margin="5"
Content="Expanded"
Visibility="Collapsed"
Name="expand" />
</Grid>
</Window>
CS:
public MainWindow()
{
InitializeComponent();
}
private void Button_Click(object sender, RoutedEventArgs e)
{
this.expand.Visibility = (this.expand.Visibility == System.Windows.Visibility.Visible) ? System.Windows.Visibility.Collapsed : System.Windows.Visibility.Visible;
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
GlassHelper.GlassFrame(this);
// this is my aero-glass class. It extends glass over clientarea and repeats
// this when WM_THEMECHANGED or WM_DWMCOMPOSITIONCHANGED is recieved.
}
你能提供一個小的測試用例來證明問題嗎? – 2011-05-12 01:19:11
當然,但爲了我的目的,我只是簡單地將我的內容做成靜態的,並且我的元素始終可見......但如果您能幫助我爲我的問題提供解決方案,這將幫助我提供更好,更易於使用桂!這個例子會在幾分鐘後出現。 – Kerwindena 2011-05-12 13:28:41
我能夠指出,這個問題只出現在我的筆記本電腦的1920x1080px分辨率。作爲其中一個shorterst示例,請參閱上面的編輯。 – Kerwindena 2011-05-12 14:02:37