mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
-
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
using Microsoft.Win32;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
@@ -20,9 +21,18 @@ namespace CustomControls
|
||||
|
||||
public bool darkTheme = false;
|
||||
|
||||
private static bool IsDarkTheme()
|
||||
{
|
||||
using var key = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize");
|
||||
var registryValueObject = key?.GetValue("AppsUseLightTheme");
|
||||
|
||||
if (registryValueObject == null) return false;
|
||||
return (int)registryValueObject <= 0;
|
||||
}
|
||||
|
||||
public void InitTheme(bool setDPI = true)
|
||||
{
|
||||
bool newDarkTheme = CheckSystemDarkModeStatus();
|
||||
bool newDarkTheme = IsDarkTheme();
|
||||
bool changed = (darkTheme != newDarkTheme);
|
||||
darkTheme = newDarkTheme;
|
||||
|
||||
|
||||
@@ -92,6 +92,7 @@ namespace GHelper
|
||||
{
|
||||
case UserPreferenceCategory.General:
|
||||
Debug.WriteLine("Theme Changed");
|
||||
Thread.Sleep(100);
|
||||
settingsForm.InitTheme(false);
|
||||
|
||||
if (settingsForm.fans is not null && settingsForm.fans.Text != "")
|
||||
|
||||
Reference in New Issue
Block a user