ysc3839 / win32-darkmode

Example application shows how to use undocumented dark mode API introduced in Windows 10 1809.
MIT License
437 stars 48 forks source link

ListView Color Display Abnormality #25

Closed w065 closed 2 months ago

w065 commented 2 months ago

When I switch the ListView to dark mode using the following code: SetWindowTheme(hListView, L"ItemsView", NULL); // DarkMode

The dark mode effect is applied successfully, but all my custom colors are lost. It appears like this: image image

NicusorN5 commented 2 months ago

Hi, you marked this as "complete", but you didn't tell us the solution. How did you set the custom colors?

w065 commented 2 months ago

In fact, I made a mistake. The ListView is created within a tab control, where the tab control's procedure function is subclassed when dark mode is enabled. I overlooked this detail. The correct approach is to handle the ListView's drawing messages within the subclassed function.

The final result looks like this: image