From 274682d26ef576acf2004b529ca70caae8e0771c Mon Sep 17 00:00:00 2001 From: Markus Hofknecht Date: Fri, 7 Aug 2020 15:24:25 +0200 Subject: [PATCH] [Feature] Dark mode (#21), version 1.0.15.0 --- Business/Menus.cs | 1 - Config/AppColors.cs | 11 +- Config/Config.cs | 36 ++++++ Config/MenuDefines.cs | 112 +++++++++++++++-- Properties/AssemblyInfo.cs | 4 +- Properties/Settings.Designer.cs | 12 ++ Properties/Settings.settings | 3 + Resources/lang.Designer.cs | 9 ++ Resources/lang.de-DE.resx | 3 + Resources/lang.resx | 3 + UserInterface/Menu.cs | 30 +++-- UserInterface/SettingsForm.Designer.cs | 168 ++++++++++++------------- UserInterface/SettingsForm.cs | 20 +-- 13 files changed, 287 insertions(+), 125 deletions(-) diff --git a/Business/Menus.cs b/Business/Menus.cs index 40c5fe8..1670a40 100644 --- a/Business/Menus.cs +++ b/Business/Menus.cs @@ -633,7 +633,6 @@ namespace SystemTrayMenu.Business if (IsActive() && menus[0].IsUsable) { - menus[0].SetTitleColorActive(); AsList.ForEach(m => m.ShowWithFade()); timerStillActiveCheck.Start(); } diff --git a/Config/AppColors.cs b/Config/AppColors.cs index 5dcb887..ec80918 100644 --- a/Config/AppColors.cs +++ b/Config/AppColors.cs @@ -9,11 +9,20 @@ namespace SystemTrayMenu internal static class AppColors { internal static readonly Color Blue = Color.FromArgb(204, 232, 255); + internal static readonly Color DarkModeBlue = Color.FromArgb(51, 51, 51); internal static readonly Color BlueBorder = Color.FromArgb(153, 209, 255); + internal static readonly Color DarkModeBlueBorder = Color.FromArgb(20, 29, 75); internal static readonly Color Green = Color.FromArgb(194, 245, 222); + internal static readonly Color DarkModeGreen = Color.FromArgb(20, 65, 42); internal static readonly Color GreenBorder = Color.FromArgb(153, 255, 165); + internal static readonly Color DarkModeGreenBorder = Color.FromArgb(20, 75, 85); internal static readonly Color Red = Color.FromArgb(255, 204, 232); - internal static readonly Color Yellow = Color.LightYellow; + internal static readonly Color DarkModeRed = Color.FromArgb(75, 24, 52); internal static readonly Color Azure = Color.Azure; + internal static readonly Color DarkModeAzure = DarkModeBackColor1; + + internal static readonly Color DarkModeBackColor3 = Color.FromArgb(25, 25, 25); + internal static readonly Color DarkModeBackColor2 = Color.FromArgb(32, 32, 32); + internal static readonly Color DarkModeBackColor1 = Color.FromArgb(43, 43, 43); } } \ No newline at end of file diff --git a/Config/Config.cs b/Config/Config.cs index aab9b5b..cdc28c9 100644 --- a/Config/Config.cs +++ b/Config/Config.cs @@ -8,6 +8,7 @@ namespace SystemTrayMenu using System.IO; using System.Reflection; using System.Windows.Forms; + using Microsoft.Win32; using SystemTrayMenu.UserInterface.FolderBrowseDialog; using SystemTrayMenu.Utilities; @@ -15,6 +16,9 @@ namespace SystemTrayMenu { public const string Language = "en"; + private static bool readDarkModeDone = false; + private static bool isDarkModeFromFirstCall = false; + public static string Path => Properties.Settings.Default.PathDirectory; public static void UpgradeIfNotUpgraded() @@ -95,5 +99,37 @@ namespace SystemTrayMenu Process.Start(browserPath, "https://github.com/Hofknecht/SystemTrayMenu#FAQ"); } } + + internal static bool IsDarkMode() + { + bool isDarkMode = false; + if (readDarkModeDone) + { + isDarkMode = isDarkModeFromFirstCall; + } + else + { + if (Properties.Settings.Default.IsDarkModeAlwaysOn || IsDarkModeActive()) + { + isDarkModeFromFirstCall = true; + isDarkMode = true; + } + + readDarkModeDone = true; + } + + return isDarkMode; + } + + /// + /// Read the OS setting whether dark mode is enabled. + /// + /// true = Dark mode; false = Light mode. + private static bool IsDarkModeActive() + { + // Check: AppsUseLightTheme (REG_DWORD) + // 0 = Dark mode, 1 = Light mode + return Registry.GetValue("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", "AppsUseLightTheme", 1).ToString() == "0"; + } } } diff --git a/Config/MenuDefines.cs b/Config/MenuDefines.cs index 6181111..ece7d01 100644 --- a/Config/MenuDefines.cs +++ b/Config/MenuDefines.cs @@ -15,12 +15,110 @@ namespace SystemTrayMenu internal const float MaxMenuWidth = 300; internal static readonly Color File = Color.White; internal static readonly Color Folder = Color.White; - internal static readonly Color ColorSelectedItem = AppColors.Blue; - internal static readonly Color ColorSelectedItemBorder = AppColors.BlueBorder; - internal static readonly Color ColorOpenFolder = AppColors.Green; - internal static readonly Color ColorOpenFolderBorder = AppColors.GreenBorder; - internal static readonly Color ColorTitleWarning = AppColors.Red; - internal static readonly Color ColorTitleSelected = AppColors.Yellow; - internal static readonly Color ColorTitleBackground = AppColors.Azure; + + public static Color ColorSelectedItem + { + get + { + if (Config.IsDarkMode()) + { + return AppColors.DarkModeBlue; + } + else + { + return AppColors.Blue; + } + } + } + + public static Color ColorSelectedItemBorder + { + get + { + if (Config.IsDarkMode()) + { + return AppColors.DarkModeBlueBorder; + } + else + { + return AppColors.BlueBorder; + } + } + } + + public static Color ColorOpenFolder + { + get + { + if (Config.IsDarkMode()) + { + return AppColors.DarkModeGreen; + } + else + { + return AppColors.Green; + } + } + } + + public static Color ColorOpenFolderBorder + { + get + { + if (Config.IsDarkMode()) + { + return AppColors.DarkModeGreenBorder; + } + else + { + return AppColors.GreenBorder; + } + } + } + + public static Color ColorTitleWarning + { + get + { + if (Config.IsDarkMode()) + { + return AppColors.DarkModeRed; + } + else + { + return AppColors.Red; + } + } + } + + public static Color ColorTitleSelected + { + get + { + if (Config.IsDarkMode()) + { + return AppColors.DarkModeBlue; + } + else + { + return AppColors.Blue; + } + } + } + + public static Color ColorTitleBackground + { + get + { + if (Config.IsDarkMode()) + { + return AppColors.DarkModeAzure; + } + else + { + return AppColors.Azure; + } + } + } } } \ No newline at end of file diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index 363d777..947db1f 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -39,5 +39,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.14.4")] -[assembly: AssemblyFileVersion("1.0.14.4")] +[assembly: AssemblyVersion("1.0.15.0")] +[assembly: AssemblyFileVersion("1.0.15.0")] diff --git a/Properties/Settings.Designer.cs b/Properties/Settings.Designer.cs index d4ceec9..f5227f8 100644 --- a/Properties/Settings.Designer.cs +++ b/Properties/Settings.Designer.cs @@ -111,5 +111,17 @@ namespace SystemTrayMenu.Properties { this["OpenItemWithOneClick"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool IsDarkModeAlwaysOn { + get { + return ((bool)(this["IsDarkModeAlwaysOn"])); + } + set { + this["IsDarkModeAlwaysOn"] = value; + } + } } } diff --git a/Properties/Settings.settings b/Properties/Settings.settings index 0ccc7c1..b5e3c0e 100644 --- a/Properties/Settings.settings +++ b/Properties/Settings.settings @@ -23,5 +23,8 @@ False + + False + \ No newline at end of file diff --git a/Resources/lang.Designer.cs b/Resources/lang.Designer.cs index 5e23e91..32b750d 100644 --- a/Resources/lang.Designer.cs +++ b/Resources/lang.Designer.cs @@ -123,6 +123,15 @@ namespace SystemTrayMenu.Resources { } } + /// + /// Looks up a localized string similar to Dark Mode always active. + /// + internal static string Dark_Mode_always_active { + get { + return ResourceManager.GetString("Dark Mode always active", resourceCulture); + } + } + /// /// Looks up a localized string similar to Exit. /// diff --git a/Resources/lang.de-DE.resx b/Resources/lang.de-DE.resx index 482692a..e1b4f0d 100644 --- a/Resources/lang.de-DE.resx +++ b/Resources/lang.de-DE.resx @@ -204,4 +204,7 @@ Öffnen durch einfachen Klick + + Dark Mode immer aktiv + \ No newline at end of file diff --git a/Resources/lang.resx b/Resources/lang.resx index 6a5443f..fc09227 100644 --- a/Resources/lang.resx +++ b/Resources/lang.resx @@ -204,4 +204,7 @@ Single-click to open an item + + Dark Mode always active + \ No newline at end of file diff --git a/UserInterface/Menu.cs b/UserInterface/Menu.cs index d3871fb..c4fada4 100644 --- a/UserInterface/Menu.cs +++ b/UserInterface/Menu.cs @@ -11,6 +11,7 @@ namespace SystemTrayMenu.UserInterface using System.Linq; using System.Reflection; using System.Windows.Forms; + using Microsoft.Win32; using SystemTrayMenu.DataClasses; using SystemTrayMenu.DllImports; using SystemTrayMenu.Utilities; @@ -58,7 +59,6 @@ namespace SystemTrayMenu.UserInterface textBoxSearch.Focus(); NativeMethods.User32ShowInactiveTopmost(this); NativeMethods.ForceForegroundWindow(Handle); - SetTitleColorActive(); } } else @@ -81,10 +81,29 @@ namespace SystemTrayMenu.UserInterface SetDoubleBuffer(dgv, true); + Color foreColor = Color.Black; + Color backColor = Color.White; + if (Config.IsDarkMode()) + { + foreColor = Color.White; + labelTitle.ForeColor = foreColor; + labelTitle.BackColor = AppColors.DarkModeBackColor1; + + backColor = AppColors.DarkModeBackColor2; + tableLayoutPanel.BackColor = backColor; + dgv.BackgroundColor = backColor; + + textBoxSearch.ForeColor = foreColor; + textBoxSearch.BackColor = AppColors.DarkModeBackColor3; + pictureBoxSearch.BackColor = AppColors.DarkModeBackColor3; + tableLayoutPanelSearch.BackColor = AppColors.DarkModeBackColor3; + } + DataGridViewCellStyle dgvCellStyle = new DataGridViewCellStyle { - SelectionBackColor = MenuDefines.ColorSelectedItem, - SelectionForeColor = Color.Black, + SelectionForeColor = foreColor, + ForeColor = foreColor, + BackColor = backColor, }; dgv.DefaultCellStyle = dgvCellStyle; @@ -378,11 +397,6 @@ namespace SystemTrayMenu.UserInterface Location = new Point(x, y); } - internal void SetTitleColorActive() - { - labelTitle.ForeColor = Color.Black; - } - internal void KeyPressedSearch(string letter) { textBoxSearch.Text += letter; diff --git a/UserInterface/SettingsForm.Designer.cs b/UserInterface/SettingsForm.Designer.cs index dd1bf1a..26e4498 100644 --- a/UserInterface/SettingsForm.Designer.cs +++ b/UserInterface/SettingsForm.Designer.cs @@ -53,20 +53,19 @@ namespace SystemTrayMenu.UserInterface this.buttonOk = new System.Windows.Forms.Button(); this.buttonCancel = new System.Windows.Forms.Button(); this.tabPageExpert = new System.Windows.Forms.TabPage(); - this.tableLayoutPanel6 = new System.Windows.Forms.TableLayoutPanel(); - this.labelHideTaskbarForm = new System.Windows.Forms.Label(); - this.labelOpenItemWithOneClick = new System.Windows.Forms.Label(); + this.tableLayoutPanelExpert = new System.Windows.Forms.TableLayoutPanel(); this.checkBoxOpenItemWithOneClick = new System.Windows.Forms.CheckBox(); this.checkBoxHideTaskbarForm = new System.Windows.Forms.CheckBox(); + this.checkBoxDarkModeAlwaysOn = new System.Windows.Forms.CheckBox(); this.tableLayoutPanelMain.SuspendLayout(); this.tabControlExpert.SuspendLayout(); this.tabPageGeneral.SuspendLayout(); this.tableLayoutPanelGeneral.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout(); this.tableLayoutPanel5.SuspendLayout(); - this.tableLayoutPanelBottom.SuspendLayout(); this.tabPageExpert.SuspendLayout(); - this.tableLayoutPanel6.SuspendLayout(); + this.tableLayoutPanelExpert.SuspendLayout(); + this.tableLayoutPanelBottom.SuspendLayout(); this.SuspendLayout(); // // tableLayoutPanelMain @@ -85,12 +84,12 @@ namespace SystemTrayMenu.UserInterface this.tableLayoutPanelMain.Size = new System.Drawing.Size(401, 275); this.tableLayoutPanelMain.TabIndex = 0; // - // tabControl1 + // tabControlExpert // this.tabControlExpert.Controls.Add(this.tabPageGeneral); this.tabControlExpert.Controls.Add(this.tabPageExpert); this.tabControlExpert.Location = new System.Drawing.Point(3, 3); - this.tabControlExpert.Name = "tabControl1"; + this.tabControlExpert.Name = "tabControlExpert"; this.tabControlExpert.SelectedIndex = 0; this.tabControlExpert.Size = new System.Drawing.Size(395, 240); this.tabControlExpert.TabIndex = 0; @@ -328,6 +327,61 @@ namespace SystemTrayMenu.UserInterface this.tableLayoutPanel2.Size = new System.Drawing.Size(100, 0); this.tableLayoutPanel2.TabIndex = 0; // + // tabPageExpert + // + this.tabPageExpert.Controls.Add(this.tableLayoutPanelExpert); + this.tabPageExpert.Location = new System.Drawing.Point(4, 22); + this.tabPageExpert.Name = "tabPageExpert"; + this.tabPageExpert.Size = new System.Drawing.Size(387, 214); + this.tabPageExpert.TabIndex = 1; + this.tabPageExpert.Text = "tabPageExpert"; + this.tabPageExpert.UseVisualStyleBackColor = true; + // + // tableLayoutPanelExpert + // + this.tableLayoutPanelExpert.AutoSize = true; + this.tableLayoutPanelExpert.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.tableLayoutPanelExpert.ColumnCount = 3; + this.tableLayoutPanelExpert.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanelExpert.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanelExpert.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 12F)); + this.tableLayoutPanelExpert.Controls.Add(this.checkBoxDarkModeAlwaysOn, 0, 2); + this.tableLayoutPanelExpert.Controls.Add(this.checkBoxOpenItemWithOneClick, 0, 1); + this.tableLayoutPanelExpert.Controls.Add(this.checkBoxHideTaskbarForm, 0, 0); + this.tableLayoutPanelExpert.Location = new System.Drawing.Point(3, 3); + this.tableLayoutPanelExpert.Name = "tableLayoutPanelExpert"; + this.tableLayoutPanelExpert.RowCount = 4; + this.tableLayoutPanelExpert.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanelExpert.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanelExpert.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanelExpert.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 40F)); + this.tableLayoutPanelExpert.Size = new System.Drawing.Size(215, 112); + this.tableLayoutPanelExpert.TabIndex = 1; + // + // checkBoxOpenItemWithOneClick + // + this.checkBoxOpenItemWithOneClick.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); + this.checkBoxOpenItemWithOneClick.AutoSize = true; + this.checkBoxOpenItemWithOneClick.Location = new System.Drawing.Point(9, 31); + this.checkBoxOpenItemWithOneClick.Margin = new System.Windows.Forms.Padding(9, 7, 9, 0); + this.checkBoxOpenItemWithOneClick.Name = "checkBoxOpenItemWithOneClick"; + this.checkBoxOpenItemWithOneClick.Size = new System.Drawing.Size(185, 17); + this.checkBoxOpenItemWithOneClick.TabIndex = 106; + this.checkBoxOpenItemWithOneClick.Text = "checkBoxOpenItemWithOneClick"; + this.checkBoxOpenItemWithOneClick.UseVisualStyleBackColor = true; + // + // checkBoxHideTaskbarForm + // + this.checkBoxHideTaskbarForm.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); + this.checkBoxHideTaskbarForm.AutoSize = true; + this.checkBoxHideTaskbarForm.Location = new System.Drawing.Point(9, 7); + this.checkBoxHideTaskbarForm.Margin = new System.Windows.Forms.Padding(9, 7, 9, 0); + this.checkBoxHideTaskbarForm.Name = "checkBoxHideTaskbarForm"; + this.checkBoxHideTaskbarForm.Size = new System.Drawing.Size(185, 17); + this.checkBoxHideTaskbarForm.TabIndex = 107; + this.checkBoxHideTaskbarForm.Text = "checkBoxShowTaskbarForm"; + this.checkBoxHideTaskbarForm.UseVisualStyleBackColor = true; + // // tableLayoutPanelBottom // this.tableLayoutPanelBottom.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); @@ -376,84 +430,17 @@ namespace SystemTrayMenu.UserInterface this.buttonCancel.UseVisualStyleBackColor = true; this.buttonCancel.Click += new System.EventHandler(this.ButtonCancel_Click); // - // tabPageExpert + // checkBoxDarkModeAlwaysOn // - this.tabPageExpert.Controls.Add(this.tableLayoutPanel6); - this.tabPageExpert.Location = new System.Drawing.Point(4, 22); - this.tabPageExpert.Name = "tabPageExpert"; - this.tabPageExpert.Size = new System.Drawing.Size(387, 214); - this.tabPageExpert.TabIndex = 1; - this.tabPageExpert.Text = "tabPageExpert"; - this.tabPageExpert.UseVisualStyleBackColor = true; - // - // tableLayoutPanel6 - // - this.tableLayoutPanel6.AutoSize = true; - this.tableLayoutPanel6.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.tableLayoutPanel6.ColumnCount = 3; - this.tableLayoutPanel6.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.tableLayoutPanel6.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.tableLayoutPanel6.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 12F)); - this.tableLayoutPanel6.Controls.Add(this.labelHideTaskbarForm, 0, 0); - this.tableLayoutPanel6.Controls.Add(this.labelOpenItemWithOneClick, 0, 1); - this.tableLayoutPanel6.Controls.Add(this.checkBoxOpenItemWithOneClick, 1, 1); - this.tableLayoutPanel6.Controls.Add(this.checkBoxHideTaskbarForm, 1, 0); - this.tableLayoutPanel6.Location = new System.Drawing.Point(3, 3); - this.tableLayoutPanel6.Name = "tableLayoutPanel6"; - this.tableLayoutPanel6.RowCount = 3; - this.tableLayoutPanel6.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanel6.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanel6.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 40F)); - this.tableLayoutPanel6.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.tableLayoutPanel6.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.tableLayoutPanel6.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.tableLayoutPanel6.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.tableLayoutPanel6.Size = new System.Drawing.Size(361, 88); - this.tableLayoutPanel6.TabIndex = 1; - // - // labelShowTaskbarForm - // - this.labelHideTaskbarForm.Anchor = System.Windows.Forms.AnchorStyles.Left; - this.labelHideTaskbarForm.AutoSize = true; - this.labelHideTaskbarForm.Location = new System.Drawing.Point(3, 5); - this.labelHideTaskbarForm.Name = "labelShowTaskbarForm"; - this.labelHideTaskbarForm.Size = new System.Drawing.Size(118, 13); - this.labelHideTaskbarForm.TabIndex = 104; - this.labelHideTaskbarForm.Text = "labelShowTaskbarForm"; - // - // labelOpenItemWithOneClick - // - this.labelOpenItemWithOneClick.Anchor = System.Windows.Forms.AnchorStyles.Left; - this.labelOpenItemWithOneClick.AutoSize = true; - this.labelOpenItemWithOneClick.Location = new System.Drawing.Point(3, 29); - this.labelOpenItemWithOneClick.Name = "labelOpenItemWithOneClick"; - this.labelOpenItemWithOneClick.Size = new System.Drawing.Size(140, 13); - this.labelOpenItemWithOneClick.TabIndex = 105; - this.labelOpenItemWithOneClick.Text = "labelOpenItemWithOneClick"; - // - // checkBoxOpenItemWithOneClick - // - this.checkBoxOpenItemWithOneClick.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - this.checkBoxOpenItemWithOneClick.AutoSize = true; - this.checkBoxOpenItemWithOneClick.Location = new System.Drawing.Point(155, 31); - this.checkBoxOpenItemWithOneClick.Margin = new System.Windows.Forms.Padding(9, 7, 9, 0); - this.checkBoxOpenItemWithOneClick.Name = "checkBoxOpenItemWithOneClick"; - this.checkBoxOpenItemWithOneClick.Size = new System.Drawing.Size(185, 17); - this.checkBoxOpenItemWithOneClick.TabIndex = 106; - this.checkBoxOpenItemWithOneClick.Text = "checkBoxOpenItemWithOneClick"; - this.checkBoxOpenItemWithOneClick.UseVisualStyleBackColor = true; - // - // checkBoxShowTaskbarForm - // - this.checkBoxHideTaskbarForm.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - this.checkBoxHideTaskbarForm.AutoSize = true; - this.checkBoxHideTaskbarForm.Location = new System.Drawing.Point(155, 7); - this.checkBoxHideTaskbarForm.Margin = new System.Windows.Forms.Padding(9, 7, 9, 0); - this.checkBoxHideTaskbarForm.Name = "checkBoxShowTaskbarForm"; - this.checkBoxHideTaskbarForm.Size = new System.Drawing.Size(185, 17); - this.checkBoxHideTaskbarForm.TabIndex = 107; - this.checkBoxHideTaskbarForm.Text = "checkBoxShowTaskbarForm"; - this.checkBoxHideTaskbarForm.UseVisualStyleBackColor = true; + this.checkBoxDarkModeAlwaysOn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); + this.checkBoxDarkModeAlwaysOn.AutoSize = true; + this.checkBoxDarkModeAlwaysOn.Location = new System.Drawing.Point(9, 55); + this.checkBoxDarkModeAlwaysOn.Margin = new System.Windows.Forms.Padding(9, 7, 9, 0); + this.checkBoxDarkModeAlwaysOn.Name = "checkBoxDarkModeAlwaysOn"; + this.checkBoxDarkModeAlwaysOn.Size = new System.Drawing.Size(185, 17); + this.checkBoxDarkModeAlwaysOn.TabIndex = 108; + this.checkBoxDarkModeAlwaysOn.Text = "checkBoxDarkModeAlwaysOn"; + this.checkBoxDarkModeAlwaysOn.UseVisualStyleBackColor = true; // // SettingsForm // @@ -482,12 +469,12 @@ namespace SystemTrayMenu.UserInterface this.tableLayoutPanel1.PerformLayout(); this.tableLayoutPanel5.ResumeLayout(false); this.tableLayoutPanel5.PerformLayout(); - this.tableLayoutPanelBottom.ResumeLayout(false); - this.tableLayoutPanelBottom.PerformLayout(); this.tabPageExpert.ResumeLayout(false); this.tabPageExpert.PerformLayout(); - this.tableLayoutPanel6.ResumeLayout(false); - this.tableLayoutPanel6.PerformLayout(); + this.tableLayoutPanelExpert.ResumeLayout(false); + this.tableLayoutPanelExpert.PerformLayout(); + this.tableLayoutPanelBottom.ResumeLayout(false); + this.tableLayoutPanelBottom.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); @@ -518,10 +505,9 @@ namespace SystemTrayMenu.UserInterface private System.Windows.Forms.Label labelHotkey; private System.Windows.Forms.TableLayoutPanel tableLayoutPanelGeneral; private System.Windows.Forms.TabPage tabPageExpert; - private System.Windows.Forms.TableLayoutPanel tableLayoutPanel6; - private System.Windows.Forms.Label labelHideTaskbarForm; - private System.Windows.Forms.Label labelOpenItemWithOneClick; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanelExpert; private System.Windows.Forms.CheckBox checkBoxOpenItemWithOneClick; private System.Windows.Forms.CheckBox checkBoxHideTaskbarForm; + private System.Windows.Forms.CheckBox checkBoxDarkModeAlwaysOn; } } \ No newline at end of file diff --git a/UserInterface/SettingsForm.cs b/UserInterface/SettingsForm.cs index 29f6591..1e5263b 100644 --- a/UserInterface/SettingsForm.cs +++ b/UserInterface/SettingsForm.cs @@ -35,10 +35,9 @@ namespace SystemTrayMenu.UserInterface checkBoxAutostart.Text = Translator.GetText("Launch on startup"); labelHotkey.Text = Translator.GetText("Hotkey"); labelLanguage.Text = Translator.GetText("Language"); - labelHideTaskbarForm.Text = string.Empty; checkBoxHideTaskbarForm.Text = Translator.GetText("Hide Taskbar Icon"); - labelOpenItemWithOneClick.Text = string.Empty; checkBoxOpenItemWithOneClick.Text = Translator.GetText("Single click to start item"); + checkBoxDarkModeAlwaysOn.Text = Translator.GetText("Dark Mode always active"); buttonOk.Text = Translator.GetText("buttonOk"); buttonCancel.Text = Translator.GetText("buttonCancel"); } @@ -81,19 +80,9 @@ namespace SystemTrayMenu.UserInterface } } - InitializeHideTaskbarForm(); - void InitializeHideTaskbarForm() - { - checkBoxHideTaskbarForm.Checked = - Properties.Settings.Default.HideTaskbarForm; - } - - InitializeOpenItemWithOneClick(); - void InitializeOpenItemWithOneClick() - { - checkBoxOpenItemWithOneClick.Checked = - Properties.Settings.Default.OpenItemWithOneClick; - } + checkBoxHideTaskbarForm.Checked = Properties.Settings.Default.HideTaskbarForm; + checkBoxOpenItemWithOneClick.Checked = Properties.Settings.Default.OpenItemWithOneClick; + checkBoxDarkModeAlwaysOn.Checked = Properties.Settings.Default.IsDarkModeAlwaysOn; } public string NewHotKey => newHotKey; @@ -309,6 +298,7 @@ namespace SystemTrayMenu.UserInterface { Properties.Settings.Default.HideTaskbarForm = checkBoxHideTaskbarForm.Checked; Properties.Settings.Default.OpenItemWithOneClick = checkBoxOpenItemWithOneClick.Checked; + Properties.Settings.Default.IsDarkModeAlwaysOn = checkBoxDarkModeAlwaysOn.Checked; } private void ButtonCancel_Click(object sender, EventArgs e)