Skip to content

Commit

Permalink
Discard saved scale on startup
Browse files Browse the repository at this point in the history
Force the use of calculated scale (if lowres) or 1.0.
  • Loading branch information
epinter authored and NorthFury committed Feb 18, 2018
1 parent 8f1371a commit 5e73ed1
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions src/TQVaultAE.GUI/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -929,6 +929,7 @@ private void SetupFormSize()
int formWidth = 1350;
int formHeight = 910;
float initialScale = 1.0F;
Settings.Default.Scale = initialScale;
if (workingArea.Width < formWidth || workingArea.Height < formHeight)
{

Expand All @@ -938,7 +939,6 @@ private void SetupFormSize()
if (Settings.Default.Scale > initialScale)
{
Settings.Default.Scale = initialScale;
Settings.Default.Save();
}
this.ClientSize = new System.Drawing.Size((int)System.Math.Round(formWidth * Settings.Default.Scale), (int)System.Math.Round(formHeight * Settings.Default.Scale));
}
Expand All @@ -947,6 +947,7 @@ private void SetupFormSize()
this.ClientSize = new System.Drawing.Size(formWidth,formHeight);
}
TQVaultData.Database.DB.Scale = Settings.Default.Scale;
Settings.Default.Save();

// Save the height / width ratio for resizing.
this.FormDesignRatio = (float)this.Height / (float)this.Width;
Expand All @@ -956,24 +957,16 @@ private void SetupFormSize()
Convert.ToInt32((float)this.Height * 0.4F));


// Scaling for the main form and custom controls.
if (Settings.Default.Scale != 1.0F && !(workingArea.Width < formWidth || workingArea.Height < formHeight))
{
this.OriginalFormSize = this.Size;
this.OriginalFormScale = 1.0F;
}
else
this.OriginalFormSize = this.Size;
this.OriginalFormScale = Settings.Default.Scale;


if (CurrentAutoScaleDimensions.Width != Database.DesignDpi)
{
if (CurrentAutoScaleDimensions.Width != Database.DesignDpi)
{
// We do not need to scale the main form controls since autoscaling will handle it.
// Scale internally to 96 dpi for the drawing functions.
Database.DB.Scale = this.CurrentAutoScaleDimensions.Width / Database.DesignDpi;
}

// Save the original size so we can reset it.
this.OriginalFormScale = Database.DB.Scale;
this.OriginalFormSize = this.Size;
this.OriginalFormScale = Database.DB.Scale;
}

this.LastFormSize = this.Size;
Expand Down

0 comments on commit 5e73ed1

Please sign in to comment.