kopia lustrzana https://github.com/njcrawford/EmbroideryReader
Only save window size if not maximized or minimized, and save and restore window maximized state
This should help with the tiny window in issue #5Branch_2.1.x
rodzic
cb65256d5b
commit
b1d1fd0c89
|
@ -50,7 +50,8 @@ namespace embroideryReader
|
|||
private const String SETTING_LAST_OPEN_FILE_FOLDER = "last open file folder";
|
||||
|
||||
private const String SETTING_LAST_SAVE_IMAGE_LOCATION = "last save image location";
|
||||
|
||||
|
||||
private const String SETTING_WINDOW_MAXIMIZED = "window maximized";
|
||||
private const String SETTING_WINDOW_WIDTH = "window width";
|
||||
private const String SETTING_WINDOW_HEIGHT = "window height";
|
||||
private const String SETTING_AUTOSCALE_DESIGN = "auto scale design";
|
||||
|
@ -283,6 +284,18 @@ namespace embroideryReader
|
|||
}
|
||||
}
|
||||
|
||||
public bool windowMaximized
|
||||
{
|
||||
get
|
||||
{
|
||||
return settings.getValue(SETTING_WINDOW_MAXIMIZED, false);
|
||||
}
|
||||
set
|
||||
{
|
||||
settings.setValue(SETTING_WINDOW_MAXIMIZED, value);
|
||||
}
|
||||
}
|
||||
|
||||
public int windowWidth
|
||||
{
|
||||
get
|
||||
|
|
|
@ -71,8 +71,17 @@ namespace embroideryReader
|
|||
{
|
||||
panel2.BackColor = Color.FromKnownColor(KnownColor.Control);
|
||||
}
|
||||
this.Width = settings.windowWidth;
|
||||
this.Height = settings.windowHeight;
|
||||
if (settings.windowMaximized)
|
||||
{
|
||||
// Check maximized first
|
||||
this.WindowState = FormWindowState.Maximized;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Not maximized, restore last saved window size
|
||||
this.Width = settings.windowWidth;
|
||||
this.Height = settings.windowHeight;
|
||||
}
|
||||
setDesignScaleSetting(1.0f, settings.AutoScaleDesign, false);
|
||||
}
|
||||
|
||||
|
@ -407,8 +416,21 @@ namespace embroideryReader
|
|||
|
||||
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
settings.windowWidth = this.Width;
|
||||
settings.windowHeight = this.Height;
|
||||
if (this.WindowState == FormWindowState.Maximized)
|
||||
{
|
||||
settings.windowMaximized = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
settings.windowMaximized = false;
|
||||
|
||||
if (this.WindowState == FormWindowState.Normal)
|
||||
{
|
||||
// If window is not minimized or maximized, save current size
|
||||
settings.windowWidth = this.Width;
|
||||
settings.windowHeight = this.Height;
|
||||
}
|
||||
}
|
||||
settings.save();
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue