diff --git a/source/ChanSort/MainForm.Designer.cs b/source/ChanSort/MainForm.Designer.cs index 75d4212..03ab19a 100644 --- a/source/ChanSort/MainForm.Designer.cs +++ b/source/ChanSort/MainForm.Designer.cs @@ -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(); diff --git a/source/ChanSort/MainForm.cs b/source/ChanSort/MainForm.cs index 75df646..606215d 100644 --- a/source/ChanSort/MainForm.cs +++ b/source/ChanSort/MainForm.cs @@ -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(); } diff --git a/source/ChanSort/Properties/Config.cs b/source/ChanSort/Properties/Config.cs index 6dff838..151f0a8 100644 --- a/source/ChanSort/Properties/Config.cs +++ b/source/ChanSort/Properties/Config.cs @@ -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; diff --git a/source/changelog.md b/source/changelog.md index e420f7a..f4c98a5 100644 --- a/source/changelog.md +++ b/source/changelog.md @@ -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)