In an C++ MFC project I'm using CMFCMenuButton using MSVC 2013.
When I toggle the high contrast mode the button is not properly repainted (for comparison a normal button is displayed):

Calling Invalidate() or ShowWindow(SW_HIDE);ShowWindow(SW_SHOW); seem to have no effect - even minimizing the dialog does not cause a proper redraw. How can I force the button to repaint with the updated system color?
Update: Forcing the colors after toggling contrast mode just makes the button text visible, however the button itself, the border, is not visible.
m_ctrlOkButton.SetFaceColor(::GetSysColor(COLOR_BTNFACE));
m_ctrlOkButton.SetTextColor(::GetSysColor(COLOR_BTNTEXT));
Took me a while, but I was able to solve this. I'm inheriting from the
CMFCMenuButtonclass so that I can handle some events:Get the color on the button right:
Handle the
WM_SYSCOLORCHANGEevent and callGetGlobalData()->UpdateSysColors();(make sure it's propagated to our parent before, e.g., by__super::OnSysColorChange();)Get the border and background right:
Handle the
WM_THEMECHANGEDevent and callCMFCVisualManager::GetInstance()->DestroyInstance();in order to close all opened theme data handles.