How to set my .net Win32 Desktop forms to fit Windows 10 Light and Dark theme?

Steven Young 261 Reputation points
2020-08-21T08:54:25.147+00:00

In Windows 10, after set to dark theme, why my Win32 Desktop .net program will not convert to dark mode? thank you.

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,498 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Castorix31 82,751 Reputation points
    2020-08-21T09:11:10.183+00:00

    The dark/light mode change can be detected with WM_SETTINGCHANGE and lParam = "ImmersiveColorSet"

    Then you can change colors from Windows.UI.ViewManagement.UIColorType

    or Immersive color APIs like GetImmersiveColorFromColorSetEx

    (I had posted a C++ sample to enumerate immersive colors in this thread)

    0 comments No comments