Hi!
I will get and set System Parameters like this in c#:
this.Top = Properties.Settings.Default.Top;
this.Left = Properties.Settings.Default.Left;
this.Height = Properties.Settings.Default.Height;
this.Width = Properties.Settings.Default.Width;
this.Closing += MainWindow_Closing;
// Bildschirmgröße anpassen falls zu klein!
HOEHE = Convert.ToInt32(System.Windows.SystemParameters.PrimaryScreenHeight);
BREITE = Convert.ToInt32(System.Windows.SystemParameters.PrimaryScreenWidth);
if (BREITE < 1200)
{
this.Width = SystemParameters.PrimaryScreenWidth;
this.MaxWidth = SystemParameters.PrimaryScreenWidth;
this.WindowState = WindowState.Maximized;
}
if (HOEHE < 800)
{
this.Height = SystemParameters.PrimaryScreenHeight;
this.MaxHeight = SystemParameters.PrimaryScreenHeight;
this.WindowState = WindowState.Maximized;
}
...
private void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
if (WindowState == WindowState.Maximized)
{
Properties.Settings.Default.Top = RestoreBounds.Top;
Properties.Settings.Default.Left = RestoreBounds.Left;
Properties.Settings.Default.Height = RestoreBounds.Height;
Properties.Settings.Default.Width = RestoreBounds.Width;
}
else
{
Properties.Settings.Default.Top = this.Top;
Properties.Settings.Default.Left = this.Left;
Properties.Settings.Default.Height = this.Height;
Properties.Settings.Default.Width = this.Width;
}
Properties.Settings.Default.Save();
}
Have anypne an idea for this?
Best Regards
Bernd