1

I am building a form using aero-glass as background, as I described in "Windows Aero Glass background is broken after hibernate. How can I solve this?". The window has ResizeMode="NoResize" SizeToContent="WidthAndHeight" set.

There is a Grid, with some fixed columns and one variable column with an element. This element is set to be visible and collapsed. My window should expand and contract by self, what works perfectly.

My problem is that after rezising all controls get blurred about 1 pixel in every dimension. After regenerating the previous size by toggeling the elements visibly-state this blurr disappeares. I got to know already, that it appears everytime the window ist programmly resized. If it is resized by the user, by just draging the corner (ofcourse without the ResizeMode="NoResize") the controls stay clear.

SnapsToDevicePixels="True" seems to have no effect on this behaviour.

If Aero Glass is disabled everything works perfectly and stays clear.

I am looking forward to recieve your suggestions.

Thank you in advance.


Edit:

Example:

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.
}
Community
  • 1
  • 1
Legy
  • 411
  • 3
  • 9
  • Can you provide a small test-case that demonstrates the problem? – Ritch Melton May 12 '11 at 01:19
  • Sure, but acually for my purpose I did simply made my content static and my element always visible... But If you could help me to provide a solution for my problem, this would help me to provide a better and more easy to use gui! The example will follow in some minutes. – Legy May 12 '11 at 13:28
  • I was able to point out, thet this problem appears only on my laptop 1920x1080px resolution. as one of the shorterst examples see the edit above. – Legy May 12 '11 at 14:02

1 Answers1

0

You can use Invalidate() method to redraw the window or the control after you resize it programmatically... Possibly override the method for resizing would make it easier.

Matt
  • 7,100
  • 3
  • 28
  • 58