Answer the question
In order to leave comments, you need to log in
How to redraw a dialog box when it is disabled [MFC C++]?
I am creating a dialog based application.
When transferring focus to another window, another application does not redraw the frame (window) of the dialog in a paler color; but if the active window "overwrites" a part of the dialog frame (or the whole), then on the updated areas the window border becomes pale (as it should be for an inactive window).
How can I make it immediately look like an inactive window when focus is lost?
Dialog windows exhibit this behavior even when creating any application by the default MFC wizard, but document windows (when the appropriate application type option is selected) do not.
Maybe add something to the ON_WM_NCACTIVATE message handler? Neither UpdateWindow nor Invalidate help.
Answer the question
In order to leave comments, you need to log in
Try overriding ON_WM_NCACTIVATE and ON_WM_ACTIVATE:
void CMFCApplication1Dlg::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized) {
Default();
}
BOOL CMFCApplication1Dlg::OnNcActivate(BOOL active)
{
if (m_nFlags & WF_STAYACTIVE)
active = TRUE;
return(BOOL)DefWindowProc(WM_NCACTIVATE, active, 0L);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question