File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed
Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -78,6 +78,15 @@ private void InitializeTrayIcon()
7878 Localization . NotifyIfTestMode ( ) ;
7979 }
8080
81+ public static void HandleThemeChange ( )
82+ {
83+ Application . SetColorMode ( SystemColorMode . System ) ;
84+ foreach ( Form form in Application . OpenForms )
85+ {
86+ form . Invalidate ( ) ;
87+ }
88+ }
89+
8190 public static void ShowPopup ( string message , string title = null )
8291 {
8392 notifyIcon . BalloonTipTitle = title ?? "WinDynamicDesktop" ;
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ internal class HiddenForm : Form
1515 private const int ENDSESSION_CLOSEAPP = 0x1 ;
1616 private const int WM_QUERYENDSESSION = 0x11 ;
1717 private const int WM_ENDSESSION = 0x16 ;
18+ private const int WM_SETTINGCHANGE = 0x1A ;
1819 private const int WM_POWERBROADCAST = 0x0218 ;
1920 private const int PBT_POWERSETTINGCHANGE = 0x8013 ;
2021
@@ -62,6 +63,12 @@ protected override void WndProc(ref Message m)
6263 }
6364 m . Result = IntPtr . Zero ;
6465 break ;
66+ case WM_SETTINGCHANGE :
67+ if ( Marshal . PtrToStringUni ( m . LParam ) == "ImmersiveColorSet" )
68+ {
69+ AppContext . HandleThemeChange ( ) ;
70+ }
71+ break ;
6572 case WM_POWERBROADCAST :
6673 if ( m . WParam . ToInt32 ( ) == PBT_POWERSETTINGCHANGE && PowerSetting . IsExitingStandby ( m . LParam ) )
6774 {
You can’t perform that action at this time.
0 commit comments