From e59a095367e73334b523860e45a0942c138eb750 Mon Sep 17 00:00:00 2001 From: Misha Date: Sun, 1 Oct 2023 08:13:40 -0400 Subject: [PATCH] Fix DPI awareness --- Rectify11Installer/App.config | 10 +-- .../Controls/FakeCommandLink.Designer.cs | 12 +-- .../Pages/CMenuPage.Designer.cs | 10 ++- .../Pages/DebugPage.Designer.cs | 10 ++- Rectify11Installer/Pages/EulaPage.Designer.cs | 2 + .../Pages/InstallConfirmation.Designer.cs | 2 + .../Pages/InstallOptnsPage.Designer.cs | 10 ++- .../Pages/ProgressPage.Designer.cs | 12 +-- .../Pages/ThemeChoicePage.Designer.cs | 10 ++- .../Pages/UninstallPage.Designer.cs | 10 ++- .../Pages/WelcomePage.Designer.cs | 2 + .../Pages/WizardPage.Designer.cs | 12 +-- Rectify11Installer/Program.cs | 4 +- .../Properties/Settings.Designer.cs | 28 +++--- Rectify11Installer/Win32/NativeMethods.cs | 2 + Rectify11Installer/app.manifest | 90 +++++++++++++------ Rectify11Installer/frmWizard.Designer.cs | 4 +- 17 files changed, 142 insertions(+), 88 deletions(-) diff --git a/Rectify11Installer/App.config b/Rectify11Installer/App.config index de524323a..1e5746f38 100644 --- a/Rectify11Installer/App.config +++ b/Rectify11Installer/App.config @@ -1,16 +1,16 @@ - + - + - + - - + + diff --git a/Rectify11Installer/Controls/FakeCommandLink.Designer.cs b/Rectify11Installer/Controls/FakeCommandLink.Designer.cs index 5ef28139b..4cd3b2c62 100644 --- a/Rectify11Installer/Controls/FakeCommandLink.Designer.cs +++ b/Rectify11Installer/Controls/FakeCommandLink.Designer.cs @@ -63,12 +63,12 @@ private void InitializeComponent() this.lblBody.Size = new System.Drawing.Size(300, 19); this.lblBody.TabIndex = 2; this.lblBody.Text = "lblBody"; - // - // FakeCommandLink - // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; - this.AutoSize = true; + // + // FakeCommandLink + // + this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; + this.AutoSize = true; this.Controls.Add(this.lblBody); this.Controls.Add(this.pictureBox1); this.Controls.Add(this.lblTitle); diff --git a/Rectify11Installer/Pages/CMenuPage.Designer.cs b/Rectify11Installer/Pages/CMenuPage.Designer.cs index db9008095..7fca793ee 100644 --- a/Rectify11Installer/Pages/CMenuPage.Designer.cs +++ b/Rectify11Installer/Pages/CMenuPage.Designer.cs @@ -112,10 +112,12 @@ private void InitializeComponent() this.Rad4.TabStop = true; this.Rad4.Text = Rectify11Installer.Strings.Rectify11.cmenuClassicA; this.Rad4.UseVisualStyleBackColor = true; - // - // CMenuPage - // - this.Controls.Add(this.PrevImg); + // + // CMenuPage + // + this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; + this.Controls.Add(this.PrevImg); this.Controls.Add(this.Rad4); this.Controls.Add(this.Rad3); this.Controls.Add(this.Rad2); diff --git a/Rectify11Installer/Pages/DebugPage.Designer.cs b/Rectify11Installer/Pages/DebugPage.Designer.cs index 685f9b35a..3a0d35e04 100644 --- a/Rectify11Installer/Pages/DebugPage.Designer.cs +++ b/Rectify11Installer/Pages/DebugPage.Designer.cs @@ -104,10 +104,12 @@ private void InitializeComponent() this.winUIButton1.Size = new System.Drawing.Size(64, 23); this.winUIButton1.TabIndex = 5; this.winUIButton1.Click += WinUIButton1_Click; - // - // DebugPage - // - this.BackColor = System.Drawing.Color.Transparent; + // + // DebugPage + // + this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; + this.BackColor = System.Drawing.Color.Transparent; this.Controls.Add(this.winUIButton1); this.Controls.Add(this.textBox2); this.Controls.Add(this.darkAwareLabel2); diff --git a/Rectify11Installer/Pages/EulaPage.Designer.cs b/Rectify11Installer/Pages/EulaPage.Designer.cs index fbef23004..08dda9047 100644 --- a/Rectify11Installer/Pages/EulaPage.Designer.cs +++ b/Rectify11Installer/Pages/EulaPage.Designer.cs @@ -55,6 +55,8 @@ private void InitializeComponent() // // EulaPage // + this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; this.BackColor = System.Drawing.Color.Transparent; this.Controls.Add(this.richTextBox1); this.Controls.Add(this.label1); diff --git a/Rectify11Installer/Pages/InstallConfirmation.Designer.cs b/Rectify11Installer/Pages/InstallConfirmation.Designer.cs index 2d87b2cef..283e1e343 100644 --- a/Rectify11Installer/Pages/InstallConfirmation.Designer.cs +++ b/Rectify11Installer/Pages/InstallConfirmation.Designer.cs @@ -82,6 +82,8 @@ private void InitializeComponent() // // InstallConfirmation // + this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; this.Controls.Add(this.summaryFooter); this.Controls.Add(this.summaryItems); this.Controls.Add(this.summaryTitle); diff --git a/Rectify11Installer/Pages/InstallOptnsPage.Designer.cs b/Rectify11Installer/Pages/InstallOptnsPage.Designer.cs index 9f05151a4..e30f829ea 100644 --- a/Rectify11Installer/Pages/InstallOptnsPage.Designer.cs +++ b/Rectify11Installer/Pages/InstallOptnsPage.Designer.cs @@ -87,10 +87,12 @@ private void InitializeComponent() this.treeView1.Size = new System.Drawing.Size(342, 270); this.treeView1.TabIndex = 2; this.treeView1.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.treeView1_AfterCheck); - // - // InstallOptnsPage - // - this.Controls.Add(this.treeView1); + // + // InstallOptnsPage + // + this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; + this.Controls.Add(this.treeView1); this.Controls.Add(this.label1); this.Controls.Add(this.groupBox1); this.Name = "InstallOptnsPage"; diff --git a/Rectify11Installer/Pages/ProgressPage.Designer.cs b/Rectify11Installer/Pages/ProgressPage.Designer.cs index 1e8c59041..d753e161c 100644 --- a/Rectify11Installer/Pages/ProgressPage.Designer.cs +++ b/Rectify11Installer/Pages/ProgressPage.Designer.cs @@ -61,11 +61,13 @@ private void InitializeComponent() this.progressInfo.Name = "progressInfo"; this.progressInfo.Size = new System.Drawing.Size(290, 200); this.progressInfo.TabIndex = 2; - // - // ProgressPage - // - //this.Controls.Add(this.progressBar1); - this.Controls.Add(this.progressText); + // + // ProgressPage + // + this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; + //this.Controls.Add(this.progressBar1); + this.Controls.Add(this.progressText); this.Controls.Add(this.progressInfo); this.Name = "ProgressPage"; this.SideImage = global::Rectify11Installer.Properties.Resources.install; diff --git a/Rectify11Installer/Pages/ThemeChoicePage.Designer.cs b/Rectify11Installer/Pages/ThemeChoicePage.Designer.cs index d66f07307..f8b0ec0f1 100644 --- a/Rectify11Installer/Pages/ThemeChoicePage.Designer.cs +++ b/Rectify11Installer/Pages/ThemeChoicePage.Designer.cs @@ -118,10 +118,12 @@ private void InitializeComponent() this.themeSel.Items.Add(Rectify11Installer.Strings.Rectify11.themeDark); this.themeSel.Items.Add(Rectify11Installer.Strings.Rectify11.themeBlack); this.themeSel.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - // - // ThemeChoicePage - // - this.Controls.Add(this.themeTitle); + // + // ThemeChoicePage + // + this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; + this.Controls.Add(this.themeTitle); this.Controls.Add(this.themeSel); this.Controls.Add(this.randomCheckbox1); this.Controls.Add(this.randomCheckbox2); diff --git a/Rectify11Installer/Pages/UninstallPage.Designer.cs b/Rectify11Installer/Pages/UninstallPage.Designer.cs index abaa29b9e..d794364ed 100644 --- a/Rectify11Installer/Pages/UninstallPage.Designer.cs +++ b/Rectify11Installer/Pages/UninstallPage.Designer.cs @@ -88,10 +88,12 @@ private void InitializeComponent() this.treeView1.Size = new System.Drawing.Size(342, 270); this.treeView1.TabIndex = 2; this.treeView1.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.treeView1_AfterCheck); - // - // InstallOptnsPage - // - this.Controls.Add(this.treeView1); + // + // InstallOptnsPage + // + this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; + this.Controls.Add(this.treeView1); this.Controls.Add(this.label1); this.Controls.Add(this.groupBox1); this.Name = "UninstallPage"; diff --git a/Rectify11Installer/Pages/WelcomePage.Designer.cs b/Rectify11Installer/Pages/WelcomePage.Designer.cs index 7e4b1bb84..f4d513323 100644 --- a/Rectify11Installer/Pages/WelcomePage.Designer.cs +++ b/Rectify11Installer/Pages/WelcomePage.Designer.cs @@ -79,6 +79,8 @@ private void InitializeComponent() // // WelcomePage // + this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; this.BackColor = System.Drawing.Color.Transparent; this.Controls.Add(this.cmbUninstall); this.Controls.Add(this.cmbInstall); diff --git a/Rectify11Installer/Pages/WizardPage.Designer.cs b/Rectify11Installer/Pages/WizardPage.Designer.cs index 6c3150c03..afafddb91 100644 --- a/Rectify11Installer/Pages/WizardPage.Designer.cs +++ b/Rectify11Installer/Pages/WizardPage.Designer.cs @@ -29,12 +29,12 @@ protected override void Dispose(bool disposing) private void InitializeComponent() { this.SuspendLayout(); - // - // WizardPage - // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; - this.BackColor = System.Drawing.Color.Transparent; + // + // WizardPage + // + this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; + this.BackColor = System.Drawing.Color.Transparent; this.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.Name = "WizardPage"; this.Size = new System.Drawing.Size(347, 340); diff --git a/Rectify11Installer/Program.cs b/Rectify11Installer/Program.cs index bb4a58cf7..3fc2b7c87 100644 --- a/Rectify11Installer/Program.cs +++ b/Rectify11Installer/Program.cs @@ -18,7 +18,7 @@ internal static class Program [STAThread] private static void Main(string[] args) { - using var mutex = new Mutex(false, "Rectify11Setup"); + using var mutex = new Mutex(false, "Rectify11Setup"); bool isAnotherInstanceOpen = !mutex.WaitOne(TimeSpan.Zero); if (isAnotherInstanceOpen) return; if (Environment.OSVersion.Version.Build <= 18362) @@ -95,5 +95,5 @@ private static void Main(string[] args) Application.Run(new FrmWizard()); mutex.ReleaseMutex(); } - } + } } diff --git a/Rectify11Installer/Properties/Settings.Designer.cs b/Rectify11Installer/Properties/Settings.Designer.cs index 46cd8fea3..a509f09d9 100644 --- a/Rectify11Installer/Properties/Settings.Designer.cs +++ b/Rectify11Installer/Properties/Settings.Designer.cs @@ -9,18 +9,18 @@ //------------------------------------------------------------------------------ namespace Rectify11Installer.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { - return defaultInstance; - } - } - } + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.7.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } } diff --git a/Rectify11Installer/Win32/NativeMethods.cs b/Rectify11Installer/Win32/NativeMethods.cs index 2b90af259..c90e4391b 100644 --- a/Rectify11Installer/Win32/NativeMethods.cs +++ b/Rectify11Installer/Win32/NativeMethods.cs @@ -10,6 +10,8 @@ namespace Rectify11Installer.Win32 public class NativeMethods { #region P/Invoke + [DllImport("user32.dll")] + internal static extern bool SetProcessDPIAware(); [DllImport("advapi32.dll", SetLastError = true, CharSet = CharSet.Unicode)] [return: MarshalAs(UnmanagedType.Bool)] private static extern bool LookupPrivilegeValue(string? lpSystemName, string lpName, out LUID lpLuid); diff --git a/Rectify11Installer/app.manifest b/Rectify11Installer/app.manifest index 04d6d5a15..be162d4f0 100644 --- a/Rectify11Installer/app.manifest +++ b/Rectify11Installer/app.manifest @@ -1,29 +1,63 @@  - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + true + + + + + + + + + + + diff --git a/Rectify11Installer/frmWizard.Designer.cs b/Rectify11Installer/frmWizard.Designer.cs index 48817abdf..e9926167b 100644 --- a/Rectify11Installer/frmWizard.Designer.cs +++ b/Rectify11Installer/frmWizard.Designer.cs @@ -336,8 +336,8 @@ private void InitializeComponent() // // frmWizard // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; this.AutoSize = true; this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowOnly; this.BackColor = System.Drawing.SystemColors.Window;