3 ms·
> Most controls ask their parent what color they should be via a window message. There are a LARGE number of areas where this is not provided, such as the text
by ack_complete 2y ago
> Most controls ask their parent what color they should be via a window message.
There are a LARGE number of areas where this is not provided, such as the text color of a disabled control or the checkbox area of a checkbox control. Even for the cases where such customization points were provided, many of them were broken when theming was added in Windows XP and in comctl32.dll version 6 in Vista, which ignores some of them in favor of theme colors or images. Menu colors, for example, are ignored when theming is enabled.
The result is that if you want something approaching a reasonable dark theme with Win32 stock controls, you will often need to resort to full owner-drawing of the controls. This is not a minor task.
- MikeTV 2y agoDo you happen to have links to any good documentation/articles on this topic? I'm working on what amounts to a dark theme for Win32 controls and largely making it up as I go along, relying on tidbits and off-hand mentions from defunct blogs.
- ack_complete 2y agoAfraid not, had to piece together a lot of it myself. There are lots of examples available for various components of varying quality -- you'll find some code examples that don't work well with high DPI or all of the sub-modes of a control. Some controls like buttons, list boxes, list views are reasonably well behaved, especially when theming is turned off. Combo boxes and toolbars are more temperamental. Check boxes, scroll bars, menus, and message boxes require a lot of custom painting work.
- MikeTV 2y agoWould you mind sending me an email (address in profile)? I'd love to pick your brain about some of the trickier ones I'm running into.
- adzm 2y agoCheck out my win32 dark mode menu bar in case it comes in handy. Also I know far far too much about the internals of classic win32 rendering if you have questions https://github.com/adzm/win32-custom-menubar-aero-theme https://github.com/adzm/win32-custom-menubar-aero-theme
- davee 2y agoI have a reasonably complete implementation of dark mode in my open source application, Explorer++. It uses the standard Win32 controls and applies a variety of strategies to get something that looks more-or-less cohesive when dark mode is enabled. ThemeManager.cpp[0] contains the bulk of the functionality. It could be useful as a reference for how you might create a dark version of a standard Win32 control. [0] https://github.com/derceg/explorerplusplus/blob/4bad3ab95d87209bf6f30240f4acebecc528cc8b/Explorer%2B%2B/Explorer%2B%2B/ThemeManager.cpp https://github.com/derceg/explorerplusplus/blob/4bad3ab95d87...