diff --git a/ShareX.HelpersLib/Native/NativeMethods.cs b/ShareX.HelpersLib/Native/NativeMethods.cs index 7c102bb02..97a80d0c6 100644 --- a/ShareX.HelpersLib/Native/NativeMethods.cs +++ b/ShareX.HelpersLib/Native/NativeMethods.cs @@ -138,7 +138,7 @@ public static partial class NativeMethods [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true, CallingConvention = CallingConvention.Winapi)] public static extern short GetKeyState(int keyCode); - [DllImport("user32.dll", ExactSpelling = true, CharSet = CharSet.Auto)] + [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)] public static extern IntPtr GetParent(IntPtr hWnd); [DllImport("user32.dll")] @@ -716,6 +716,9 @@ public static extern int AVISaveOptions(IntPtr window, int flags, int streams, [ [DllImport("dnsapi.dll")] public static extern uint DnsFlushResolverCache(); + [DllImport("uxtheme.dll", CharSet = CharSet.Unicode, ExactSpelling = true)] + public static extern int SetWindowTheme(IntPtr hWnd, string pszSubAppName, string pszSubIdList); + #endregion Other dll } } \ No newline at end of file diff --git a/ShareX/Forms/ApplicationSettingsForm.cs b/ShareX/Forms/ApplicationSettingsForm.cs index 36932a515..ca27e636f 100644 --- a/ShareX/Forms/ApplicationSettingsForm.cs +++ b/ShareX/Forms/ApplicationSettingsForm.cs @@ -503,26 +503,32 @@ private void AddTheme(ShareXTheme theme) private void CbUseCustomTheme_CheckedChanged(object sender, EventArgs e) { - Program.Settings.UseCustomTheme = cbUseCustomTheme.Checked; - UpdateThemeControls(); - ApplySelectedTheme(); + if (ready) + { + Program.Settings.UseCustomTheme = cbUseCustomTheme.Checked; + UpdateThemeControls(); + ApplySelectedTheme(); + } } private void CbThemes_SelectedIndexChanged(object sender, EventArgs e) { - Program.Settings.SelectedTheme = cbThemes.SelectedIndex; - - if (cbThemes.SelectedItem != null) + if (ready) { - pgTheme.SelectedObject = cbThemes.SelectedItem; - } - else - { - pgTheme.SelectedObject = null; - } + Program.Settings.SelectedTheme = cbThemes.SelectedIndex; - UpdateThemeControls(); - ApplySelectedTheme(); + if (cbThemes.SelectedItem != null) + { + pgTheme.SelectedObject = cbThemes.SelectedItem; + } + else + { + pgTheme.SelectedObject = null; + } + + UpdateThemeControls(); + ApplySelectedTheme(); + } } private void BtnThemeAdd_Click(object sender, EventArgs e) diff --git a/ShareX/ShareX.csproj b/ShareX/ShareX.csproj index 9f3f50da2..9142094d3 100644 --- a/ShareX/ShareX.csproj +++ b/ShareX/ShareX.csproj @@ -22,7 +22,7 @@ - +