@rdipardo said in A question about dark mode, plugins, and an owner-draw ComboBox:
Try passing the control’s handle to the ::SetWindowTheme function provided by the uxtheme header, using L"DarkMode_CFD" as the pszSubAppName; to restore light mode, call it with the same arguments, but change pszSubAppName to a null pointer.
Thanks, Robert. At first attempt, this doesn’t appear to solve the problem.
The colors are right with just NPPM_DARKMODESUBCLASSANDTHEME; the problem is that the static control shows unknown text instead of the selected drop-down entry, and attempting to select from the drop-down produces bizarre highlighting and tracking instead of what is expected (and still doesn’t set the static control). Adding the SetWindowTheme call doesn’t change that. Removing NPPM_DARKMODESUBCLASSANDTHEME, of course, makes everything else light, and for the control in question, SetWindowTheme only seems to change the drop-down chevron. Interestingly, NPPM_DARKMODESUBCLASSANDTHEME does get all the colors right, including in the owner-drawn drop-down; it just breaks the functionality in the process.
The problem goes away entirely if I remove the CBS_OWNERDRAWFIXED style (but then, of course, it doesn’t display as intended, showing the color associated with each indicator that can be selected). That’s why I feel like the problem is most likely to do with the sub-classing. I can’t find any clear documentation on how all that works. I don’t even know why the controls are being sub-classed, and not just themed. Maybe there is a way to exempt that control from sub-classing, and do whatever it is that the sub-classing does in my own code?
A pointer to actual documentation on this design, how it works and how it is meant to be used would be wonderful, but I’m guessing no such thing exists. :-(