From 1bf932e55bb5f76426c5168244f5ed8c1dfbec00 Mon Sep 17 00:00:00 2001 From: Johann Blais Date: Wed, 28 Jan 2026 21:32:29 +0100 Subject: [PATCH 1/6] Set autoscale modes to DPI for all forms --- .../InformationBoxDesigner.Designer.cs | 2 - InfoBox.Designer/InformationBoxDesigner.cs | 1 + InfoBox.Designer/Program.cs | 3 ++ InfoBox.Designer/TextEditorForm.Designer.cs | 2 - InfoBox.Designer/TextEditorForm.cs | 10 +++- InfoBox.Designer/TextEditorForm.resx | 54 +++++++++---------- InfoBox/Form/InformationBoxForm.Designer.cs | 2 - InfoBox/Form/InformationBoxForm.cs | 9 +++- InfoBox/Form/InformationBoxForm.resx | 54 +++++++++---------- InfoBox/InfoBox.csproj | 2 + .../InfoBoxCore.Designer.csproj | 2 +- 11 files changed, 78 insertions(+), 63 deletions(-) diff --git a/InfoBox.Designer/InformationBoxDesigner.Designer.cs b/InfoBox.Designer/InformationBoxDesigner.Designer.cs index f5a6efd..7856e67 100644 --- a/InfoBox.Designer/InformationBoxDesigner.Designer.cs +++ b/InfoBox.Designer/InformationBoxDesigner.Designer.cs @@ -1543,8 +1543,6 @@ private void InitializeComponent() // // InformationBoxDesigner // - AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); - AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; ClientSize = new System.Drawing.Size(966, 790); Controls.Add(groupBox22); Controls.Add(groupBox21); diff --git a/InfoBox.Designer/InformationBoxDesigner.cs b/InfoBox.Designer/InformationBoxDesigner.cs index 5ecfe04..9bdd7c8 100644 --- a/InfoBox.Designer/InformationBoxDesigner.cs +++ b/InfoBox.Designer/InformationBoxDesigner.cs @@ -66,6 +66,7 @@ public TextBox TextContent /// public InformationBoxDesigner() { + this.AutoScaleMode = AutoScaleMode.Dpi; this.InitializeComponent(); this.LoadIcons(); diff --git a/InfoBox.Designer/Program.cs b/InfoBox.Designer/Program.cs index 66b09ab..5ca9db9 100644 --- a/InfoBox.Designer/Program.cs +++ b/InfoBox.Designer/Program.cs @@ -20,6 +20,9 @@ public static class Program [STAThread] public static void Main() { + #if NET5_0_OR_GREATER + Application.SetHighDpiMode(HighDpiMode.PerMonitorV2); + #endif Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new InformationBoxDesigner()); diff --git a/InfoBox.Designer/TextEditorForm.Designer.cs b/InfoBox.Designer/TextEditorForm.Designer.cs index 3bbc762..6059383 100644 --- a/InfoBox.Designer/TextEditorForm.Designer.cs +++ b/InfoBox.Designer/TextEditorForm.Designer.cs @@ -45,8 +45,6 @@ private void InitializeComponent() // // TextEditorForm // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(501, 344); this.Controls.Add(this.txtContent); this.MinimizeBox = false; diff --git a/InfoBox.Designer/TextEditorForm.cs b/InfoBox.Designer/TextEditorForm.cs index 60e4019..5e5cd9a 100644 --- a/InfoBox.Designer/TextEditorForm.cs +++ b/InfoBox.Designer/TextEditorForm.cs @@ -18,11 +18,19 @@ public partial class TextEditorForm : Form private readonly InformationBoxDesigner parentDesigner; private bool isUpdating = false; + /// + /// Initializes a new instance of the class. + /// + private TextEditorForm() + { + this.AutoScaleMode = AutoScaleMode.Dpi; + } + /// /// Initializes a new instance of the class. /// /// The parent designer form. - public TextEditorForm(InformationBoxDesigner parentDesigner) + public TextEditorForm(InformationBoxDesigner parentDesigner): this() { this.parentDesigner = parentDesigner ?? throw new ArgumentNullException(nameof(parentDesigner)); this.InitializeComponent(); diff --git a/InfoBox.Designer/TextEditorForm.resx b/InfoBox.Designer/TextEditorForm.resx index 1af7de1..8b2ff64 100644 --- a/InfoBox.Designer/TextEditorForm.resx +++ b/InfoBox.Designer/TextEditorForm.resx @@ -1,17 +1,17 @@  - diff --git a/InfoBox/Form/InformationBoxForm.Designer.cs b/InfoBox/Form/InformationBoxForm.Designer.cs index d8e3968..7f291e2 100644 --- a/InfoBox/Form/InformationBoxForm.Designer.cs +++ b/InfoBox/Form/InformationBoxForm.Designer.cs @@ -188,8 +188,6 @@ private void InitializeComponent() // // InformationBoxForm // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(257, 153); this.Controls.Add(this.pnlForm); this.DoubleBuffered = true; diff --git a/InfoBox/Form/InformationBoxForm.cs b/InfoBox/Form/InformationBoxForm.cs index 8d3ed19..edc9e2c 100644 --- a/InfoBox/Form/InformationBoxForm.cs +++ b/InfoBox/Form/InformationBoxForm.cs @@ -208,6 +208,13 @@ internal partial class InformationBoxForm : Form #region Constructors + /// + /// Initializes a new instance of the . + /// + private InformationBoxForm() + { + this.AutoScaleMode = AutoScaleMode.Dpi; + } /// /// Initializes a new instance of the class using the specified text. @@ -275,7 +282,7 @@ internal InformationBoxForm(string text, InformationBoxOpacity opacity = InformationBoxOpacity.NoFade, Form parent = null, InformationBoxOrder order = InformationBoxOrder.Default, - InformationBoxSound sound = InformationBoxSound.Default) + InformationBoxSound sound = InformationBoxSound.Default) : this() { this.InitializeComponent(); diff --git a/InfoBox/Form/InformationBoxForm.resx b/InfoBox/Form/InformationBoxForm.resx index 83217bb..41f61eb 100644 --- a/InfoBox/Form/InformationBoxForm.resx +++ b/InfoBox/Form/InformationBoxForm.resx @@ -1,17 +1,17 @@ - diff --git a/InfoBox/InfoBox.csproj b/InfoBox/InfoBox.csproj index aefd3d7..d1ad132 100644 --- a/InfoBox/InfoBox.csproj +++ b/InfoBox/InfoBox.csproj @@ -85,6 +85,7 @@ True MinimumRecommendedRules.ruleset false + True portable @@ -96,6 +97,7 @@ AllRules.ruleset true false + True diff --git a/InfoBoxCore.Designer/InfoBoxCore.Designer.csproj b/InfoBoxCore.Designer/InfoBoxCore.Designer.csproj index f798526..a239f42 100644 --- a/InfoBoxCore.Designer/InfoBoxCore.Designer.csproj +++ b/InfoBoxCore.Designer/InfoBoxCore.Designer.csproj @@ -1,5 +1,4 @@  - WinExe net8.0-windows;net9.0-windows;net10.0-windows @@ -13,6 +12,7 @@ InformationBox Designer Copyright © Johann Blais 2007-2026 en + true From 0959bc80a250e7047b9b4a7ff7d77eb1e0555103 Mon Sep 17 00:00:00 2001 From: Johann Blais Date: Wed, 28 Jan 2026 21:41:31 +0100 Subject: [PATCH 2/6] Added autoscale mode for the ManualTestForm --- InfoBoxCore.ManualTests/ManualTestsForm.Designer.cs | 6 ++---- InfoBoxCore.ManualTests/ManualTestsForm.cs | 1 + 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/InfoBoxCore.ManualTests/ManualTestsForm.Designer.cs b/InfoBoxCore.ManualTests/ManualTestsForm.Designer.cs index 5898d7c..3bd0eff 100644 --- a/InfoBoxCore.ManualTests/ManualTestsForm.Designer.cs +++ b/InfoBoxCore.ManualTests/ManualTestsForm.Designer.cs @@ -73,11 +73,9 @@ private void InitializeComponent() btnTestLongLinesFixedFont.Text = "Fixed width font long lines"; btnTestLongLinesFixedFont.UseVisualStyleBackColor = true; btnTestLongLinesFixedFont.Click += btnTestLongLinesFixedFont_Click; - // + // // ManualTestsForm - // - AutoScaleDimensions = new SizeF(7F, 15F); - AutoScaleMode = AutoScaleMode.Font; + // ClientSize = new Size(800, 450); Controls.Add(btnTestLongLinesFixedFont); Controls.Add(btnTestFixedWidthTwelvePoints); diff --git a/InfoBoxCore.ManualTests/ManualTestsForm.cs b/InfoBoxCore.ManualTests/ManualTestsForm.cs index 25129be..e98a8f6 100644 --- a/InfoBoxCore.ManualTests/ManualTestsForm.cs +++ b/InfoBoxCore.ManualTests/ManualTestsForm.cs @@ -6,6 +6,7 @@ public partial class ManualTestsForm : Form { public ManualTestsForm() { + this.AutoScaleMode = AutoScaleMode.Dpi; InitializeComponent(); } From f2cbb7f9cee4afba41a5e089ace4ddd5e4977f4b Mon Sep 17 00:00:00 2001 From: Johann Blais Date: Thu, 29 Jan 2026 18:50:18 +0100 Subject: [PATCH 3/6] Added fix the button layout issue (#66) --- InfoBox/Form/InformationBoxForm.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/InfoBox/Form/InformationBoxForm.cs b/InfoBox/Form/InformationBoxForm.cs index 8d3ed19..301a380 100644 --- a/InfoBox/Form/InformationBoxForm.cs +++ b/InfoBox/Form/InformationBoxForm.cs @@ -1110,8 +1110,8 @@ private void SetButtonsLayout() switch (this.buttonsLayout) { case InformationBoxButtonsLayout.GroupLeft: - initialPosition = BorderPadding; spaceBetween = BorderPadding; + initialPosition = BorderPadding; break; case InformationBoxButtonsLayout.GroupMiddle: spaceBetween = BorderPadding; @@ -1119,20 +1119,20 @@ private void SetButtonsLayout() // If there is only one button then we must center it if (buttonsCount == 1) { - initialPosition += Convert.ToInt32((Width - buttonsCount * this.pnlButtons.Controls[0].Width) / (buttonsCount + 1)); + initialPosition += Convert.ToInt32((this.pnlButtons.ClientSize.Width - this.pnlButtons.Controls[0].Width) / 2); } else { - initialPosition = Convert.ToInt32((Width - (buttonsCount * (this.pnlButtons.Controls[0].Width + BorderPadding))) / 2); + initialPosition = Convert.ToInt32((this.pnlButtons.ClientSize.Width - (buttonsCount * (this.pnlButtons.Controls[0].Width + BorderPadding))) / 2); } break; case InformationBoxButtonsLayout.GroupRight: spaceBetween = BorderPadding; - initialPosition = ClientSize.Width - (buttonsCount * (this.pnlButtons.Controls[0].Width + BorderPadding)); + initialPosition = this.pnlButtons.ClientSize.Width - (buttonsCount * (this.pnlButtons.Controls[0].Width + BorderPadding)); break; case InformationBoxButtonsLayout.Separate: - spaceBetween = Convert.ToInt32((ClientSize.Width - buttonsCount * this.pnlButtons.Controls[0].Width) / (buttonsCount + 1)); + spaceBetween = Convert.ToInt32((this.pnlButtons.ClientSize.Width - buttonsCount * this.pnlButtons.Controls[0].Width) / (buttonsCount + 1)); initialPosition = spaceBetween; break; default: From 23ee64925dd212e305331868d7553950ab6a945c Mon Sep 17 00:00:00 2001 From: Johann Blais Date: Thu, 29 Jan 2026 18:50:18 +0100 Subject: [PATCH 4/6] Added fix the button layout issue (#66) --- InfoBox/Form/InformationBoxForm.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/InfoBox/Form/InformationBoxForm.cs b/InfoBox/Form/InformationBoxForm.cs index edc9e2c..fbd564c 100644 --- a/InfoBox/Form/InformationBoxForm.cs +++ b/InfoBox/Form/InformationBoxForm.cs @@ -1117,8 +1117,8 @@ private void SetButtonsLayout() switch (this.buttonsLayout) { case InformationBoxButtonsLayout.GroupLeft: - initialPosition = BorderPadding; spaceBetween = BorderPadding; + initialPosition = BorderPadding; break; case InformationBoxButtonsLayout.GroupMiddle: spaceBetween = BorderPadding; @@ -1126,20 +1126,20 @@ private void SetButtonsLayout() // If there is only one button then we must center it if (buttonsCount == 1) { - initialPosition += Convert.ToInt32((Width - buttonsCount * this.pnlButtons.Controls[0].Width) / (buttonsCount + 1)); + initialPosition += Convert.ToInt32((this.pnlButtons.ClientSize.Width - this.pnlButtons.Controls[0].Width) / 2); } else { - initialPosition = Convert.ToInt32((Width - (buttonsCount * (this.pnlButtons.Controls[0].Width + BorderPadding))) / 2); + initialPosition = Convert.ToInt32((this.pnlButtons.ClientSize.Width - (buttonsCount * (this.pnlButtons.Controls[0].Width + BorderPadding))) / 2); } break; case InformationBoxButtonsLayout.GroupRight: spaceBetween = BorderPadding; - initialPosition = ClientSize.Width - (buttonsCount * (this.pnlButtons.Controls[0].Width + BorderPadding)); + initialPosition = this.pnlButtons.ClientSize.Width - (buttonsCount * (this.pnlButtons.Controls[0].Width + BorderPadding)); break; case InformationBoxButtonsLayout.Separate: - spaceBetween = Convert.ToInt32((ClientSize.Width - buttonsCount * this.pnlButtons.Controls[0].Width) / (buttonsCount + 1)); + spaceBetween = Convert.ToInt32((this.pnlButtons.ClientSize.Width - buttonsCount * this.pnlButtons.Controls[0].Width) / (buttonsCount + 1)); initialPosition = spaceBetween; break; default: From 9c9710467f47a3fef15fae90998abd9f58afb02b Mon Sep 17 00:00:00 2001 From: Johann Blais Date: Thu, 29 Jan 2026 18:56:34 +0100 Subject: [PATCH 5/6] Revert "Set autoscale modes to DPI for all forms" This reverts commit 1bf932e55bb5f76426c5168244f5ed8c1dfbec00. --- .../InformationBoxDesigner.Designer.cs | 2 + InfoBox.Designer/InformationBoxDesigner.cs | 1 - InfoBox.Designer/Program.cs | 3 -- InfoBox.Designer/TextEditorForm.Designer.cs | 2 + InfoBox.Designer/TextEditorForm.cs | 10 +--- InfoBox.Designer/TextEditorForm.resx | 54 +++++++++---------- InfoBox/Form/InformationBoxForm.Designer.cs | 2 + InfoBox/Form/InformationBoxForm.cs | 9 +--- InfoBox/Form/InformationBoxForm.resx | 54 +++++++++---------- InfoBox/InfoBox.csproj | 2 - .../InfoBoxCore.Designer.csproj | 2 +- 11 files changed, 63 insertions(+), 78 deletions(-) diff --git a/InfoBox.Designer/InformationBoxDesigner.Designer.cs b/InfoBox.Designer/InformationBoxDesigner.Designer.cs index 7856e67..f5a6efd 100644 --- a/InfoBox.Designer/InformationBoxDesigner.Designer.cs +++ b/InfoBox.Designer/InformationBoxDesigner.Designer.cs @@ -1543,6 +1543,8 @@ private void InitializeComponent() // // InformationBoxDesigner // + AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; ClientSize = new System.Drawing.Size(966, 790); Controls.Add(groupBox22); Controls.Add(groupBox21); diff --git a/InfoBox.Designer/InformationBoxDesigner.cs b/InfoBox.Designer/InformationBoxDesigner.cs index 9bdd7c8..5ecfe04 100644 --- a/InfoBox.Designer/InformationBoxDesigner.cs +++ b/InfoBox.Designer/InformationBoxDesigner.cs @@ -66,7 +66,6 @@ public TextBox TextContent /// public InformationBoxDesigner() { - this.AutoScaleMode = AutoScaleMode.Dpi; this.InitializeComponent(); this.LoadIcons(); diff --git a/InfoBox.Designer/Program.cs b/InfoBox.Designer/Program.cs index 5ca9db9..66b09ab 100644 --- a/InfoBox.Designer/Program.cs +++ b/InfoBox.Designer/Program.cs @@ -20,9 +20,6 @@ public static class Program [STAThread] public static void Main() { - #if NET5_0_OR_GREATER - Application.SetHighDpiMode(HighDpiMode.PerMonitorV2); - #endif Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new InformationBoxDesigner()); diff --git a/InfoBox.Designer/TextEditorForm.Designer.cs b/InfoBox.Designer/TextEditorForm.Designer.cs index 6059383..3bbc762 100644 --- a/InfoBox.Designer/TextEditorForm.Designer.cs +++ b/InfoBox.Designer/TextEditorForm.Designer.cs @@ -45,6 +45,8 @@ private void InitializeComponent() // // TextEditorForm // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(501, 344); this.Controls.Add(this.txtContent); this.MinimizeBox = false; diff --git a/InfoBox.Designer/TextEditorForm.cs b/InfoBox.Designer/TextEditorForm.cs index 5e5cd9a..60e4019 100644 --- a/InfoBox.Designer/TextEditorForm.cs +++ b/InfoBox.Designer/TextEditorForm.cs @@ -18,19 +18,11 @@ public partial class TextEditorForm : Form private readonly InformationBoxDesigner parentDesigner; private bool isUpdating = false; - /// - /// Initializes a new instance of the class. - /// - private TextEditorForm() - { - this.AutoScaleMode = AutoScaleMode.Dpi; - } - /// /// Initializes a new instance of the class. /// /// The parent designer form. - public TextEditorForm(InformationBoxDesigner parentDesigner): this() + public TextEditorForm(InformationBoxDesigner parentDesigner) { this.parentDesigner = parentDesigner ?? throw new ArgumentNullException(nameof(parentDesigner)); this.InitializeComponent(); diff --git a/InfoBox.Designer/TextEditorForm.resx b/InfoBox.Designer/TextEditorForm.resx index 8b2ff64..1af7de1 100644 --- a/InfoBox.Designer/TextEditorForm.resx +++ b/InfoBox.Designer/TextEditorForm.resx @@ -1,17 +1,17 @@  - diff --git a/InfoBox/Form/InformationBoxForm.Designer.cs b/InfoBox/Form/InformationBoxForm.Designer.cs index 7f291e2..d8e3968 100644 --- a/InfoBox/Form/InformationBoxForm.Designer.cs +++ b/InfoBox/Form/InformationBoxForm.Designer.cs @@ -188,6 +188,8 @@ private void InitializeComponent() // // InformationBoxForm // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(257, 153); this.Controls.Add(this.pnlForm); this.DoubleBuffered = true; diff --git a/InfoBox/Form/InformationBoxForm.cs b/InfoBox/Form/InformationBoxForm.cs index fbd564c..301a380 100644 --- a/InfoBox/Form/InformationBoxForm.cs +++ b/InfoBox/Form/InformationBoxForm.cs @@ -208,13 +208,6 @@ internal partial class InformationBoxForm : Form #region Constructors - /// - /// Initializes a new instance of the . - /// - private InformationBoxForm() - { - this.AutoScaleMode = AutoScaleMode.Dpi; - } /// /// Initializes a new instance of the class using the specified text. @@ -282,7 +275,7 @@ internal InformationBoxForm(string text, InformationBoxOpacity opacity = InformationBoxOpacity.NoFade, Form parent = null, InformationBoxOrder order = InformationBoxOrder.Default, - InformationBoxSound sound = InformationBoxSound.Default) : this() + InformationBoxSound sound = InformationBoxSound.Default) { this.InitializeComponent(); diff --git a/InfoBox/Form/InformationBoxForm.resx b/InfoBox/Form/InformationBoxForm.resx index 41f61eb..83217bb 100644 --- a/InfoBox/Form/InformationBoxForm.resx +++ b/InfoBox/Form/InformationBoxForm.resx @@ -1,17 +1,17 @@ - diff --git a/InfoBox/InfoBox.csproj b/InfoBox/InfoBox.csproj index d1ad132..aefd3d7 100644 --- a/InfoBox/InfoBox.csproj +++ b/InfoBox/InfoBox.csproj @@ -85,7 +85,6 @@ True MinimumRecommendedRules.ruleset false - True portable @@ -97,7 +96,6 @@ AllRules.ruleset true false - True diff --git a/InfoBoxCore.Designer/InfoBoxCore.Designer.csproj b/InfoBoxCore.Designer/InfoBoxCore.Designer.csproj index a239f42..f798526 100644 --- a/InfoBoxCore.Designer/InfoBoxCore.Designer.csproj +++ b/InfoBoxCore.Designer/InfoBoxCore.Designer.csproj @@ -1,4 +1,5 @@  + WinExe net8.0-windows;net9.0-windows;net10.0-windows @@ -12,7 +13,6 @@ InformationBox Designer Copyright © Johann Blais 2007-2026 en - true From a7bf89f9b9c5db4214361ba2953ece490cf5a8ed Mon Sep 17 00:00:00 2001 From: Johann Blais Date: Thu, 29 Jan 2026 18:57:06 +0100 Subject: [PATCH 6/6] Revert "Added autoscale mode for the ManualTestForm" This reverts commit 0959bc80a250e7047b9b4a7ff7d77eb1e0555103. --- InfoBoxCore.ManualTests/ManualTestsForm.Designer.cs | 6 ++++-- InfoBoxCore.ManualTests/ManualTestsForm.cs | 1 - 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/InfoBoxCore.ManualTests/ManualTestsForm.Designer.cs b/InfoBoxCore.ManualTests/ManualTestsForm.Designer.cs index 3bd0eff..5898d7c 100644 --- a/InfoBoxCore.ManualTests/ManualTestsForm.Designer.cs +++ b/InfoBoxCore.ManualTests/ManualTestsForm.Designer.cs @@ -73,9 +73,11 @@ private void InitializeComponent() btnTestLongLinesFixedFont.Text = "Fixed width font long lines"; btnTestLongLinesFixedFont.UseVisualStyleBackColor = true; btnTestLongLinesFixedFont.Click += btnTestLongLinesFixedFont_Click; - // + // // ManualTestsForm - // + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; ClientSize = new Size(800, 450); Controls.Add(btnTestLongLinesFixedFont); Controls.Add(btnTestFixedWidthTwelvePoints); diff --git a/InfoBoxCore.ManualTests/ManualTestsForm.cs b/InfoBoxCore.ManualTests/ManualTestsForm.cs index e98a8f6..25129be 100644 --- a/InfoBoxCore.ManualTests/ManualTestsForm.cs +++ b/InfoBoxCore.ManualTests/ManualTestsForm.cs @@ -6,7 +6,6 @@ public partial class ManualTestsForm : Form { public ManualTestsForm() { - this.AutoScaleMode = AutoScaleMode.Dpi; InitializeComponent(); }