I have noticed that even in SkinBuilder changing ComboBox settings rarely or never affects the combobox in the SkinBuilder window. Same for ListView and ListBox.
I also added code to CXTPSkinObjectComboBox::OnDraw to get the DC text color, which is always black even when our theme indicates it is white.
I also added code (this is all for debug) to get the logical brush
color from the brush returned from GetFillBackgroundBrush and it is the
color I expected. Even for the windows in the dialog image I posted here
that show a white background.
I see this in OnDraw but textThemeColor is never used:
COLORREF textThemeColor = pClassComboBox->GetThemeColor(0, nState, TMT_TEXTCOLOR);
I used that color to draw the text and still the text color is wrong. Since I only have these combobox issues. That didn't help.
I tried using the m_bPaint member to avoid the double/recursive calls that occur based on whether the box being drawn has focus that was a disaster (no text in any of those boxes in my image).
So finally I found a way out of this that lets me avoid destroying and recreating comboboxes that still exist when I apply the skin. I have found this same approach also fixes issues with .NET controls that won't draw correctly with the skin (or don't use the skin settings). I turn off the combobox Window theme when we switch to our skin. Then if the user turns off our color theme which uses the skin, I reinstate the current window theme.
Luckily I already have code that notifies all existing windows of the color theme change and whether the new or previous color theme included a skin. I have that since a lot of our UI needs adjusted, such as loading new images in image lists or whatever when the skin is dark.
So I just get each window class name and if it is a combobox/comboboxex I either disable the system theme SetWindowTheme(hWnd,L"",L""); or reset the window to use the current OS theme - SetWindowTheme(hWnd,nullptr,nullptr).
Not optimal but the CJ combobox skin code and the OS just are not cooperating if the skin is applied while the combobox already exists (visible or not).
|