- fixed issue with high-res displays / Windows display scaling other than 100% aka 96dpi, that caused columns to

become wider every time the program was started.
This commit is contained in:
Horst Beham
2021-05-01 18:24:13 +02:00
parent 35111daeda
commit b0a99064d9
4 changed files with 21 additions and 3 deletions

View File

@@ -2189,7 +2189,7 @@
this.Controls.Add(this.barDockControlTop);
this.Name = "MainForm";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing);
this.Load += new System.EventHandler(this.MainForm_Load);
this.Shown += new System.EventHandler(this.MainForm_Shown);
this.DragDrop += new System.Windows.Forms.DragEventHandler(this.MainForm_DragDrop);
this.DragEnter += new System.Windows.Forms.DragEventHandler(this.MainForm_DragEnter);
((System.ComponentModel.ISupportInitialize)(this.splitContainerControl1.Panel1)).EndInit();

View File

@@ -1297,13 +1297,25 @@ namespace ChanSort.Ui
if (Config.Default.LeftGridLayout != null)
{
this.gridLeft.ForceInitialize();
var xml = Config.Default.LeftGridLayout;
this.gviewLeft.LoadLayoutFromXml(xml);
if (Config.Default.ScaleFactor.Width != 0)
{
foreach (GridColumn col in this.gviewLeft.Columns)
col.Width = (int) (col.Width / Config.Default.ScaleFactor.Width);
}
}
if (Config.Default.RightGridLayout != null)
{
this.gridRight.ForceInitialize();
var xml = Config.Default.RightGridLayout;
this.gviewRight.LoadLayoutFromXml(xml);
if (Config.Default.ScaleFactor.Width != 0)
{
foreach (GridColumn col in this.gviewRight.Columns)
col.Width = (int)(col.Width / Config.Default.ScaleFactor.Width);
}
}
}
@@ -1928,9 +1940,9 @@ namespace ChanSort.Ui
// UI events
#region MainForm_Load
#region MainForm_Shown
private void MainForm_Load(object sender, EventArgs e)
private void MainForm_Shown(object sender, EventArgs e)
{
this.TryExecute(this.LoadSettings);
this.TryExecute(this.InitAppAfterMainWindowWasShown);
@@ -2686,6 +2698,7 @@ namespace ChanSort.Ui
Config.Default.CheckForUpdates = this.miCheckUpdates.Down;
Config.Default.LeftGridLayout = this.gviewLeft.SaveLayoutToXml();
Config.Default.RightGridLayout = this.gviewRight.SaveLayoutToXml();
Config.Default.ScaleFactor = this.absScaleFactor;
Config.Default.Save();
}

View File

@@ -55,6 +55,7 @@ namespace ChanSort.Ui.Properties
public int FontSizeDelta { get; set; }
public string LeftGridLayout { get; set; }
public string RightGridLayout { get; set; }
public SizeF ScaleFactor { get; set; }
private bool allowSave = true;

View File

@@ -1,6 +1,10 @@
ChanSort Change Log
===================
2021-05-01_1615
- fixed issue with high-res displays / Windows display scaling other than 100% aka 96dpi, that caused columns to
become wider every time the program was started.
2021-05-01
- added "Settings / Reset to defaults and restart" function to delete the stored customized settings in case something
went wrong (like massively oversized column widths)