问题
I have an MDI application. It has been developed over the years. On Windows-7 everything looks native. When I start the application on windows-10, normal dialogs will have the windows-10 look & feel. But all child views still have the Windows-7 look & feel.
I tried to change from CMDIChildWnd to CMDIChildWndEx but it made no difference to the window look & feel (except of another border style around the client rect). I do not want to change all child views to dock panes as it will change the user experience a lot. I just want to have the native look & feel for the child views.
Is this even possible? Can i easily migrate to docker windows and configure them to behave like normal windows (no docking functionality at all, min/max/restore buttons)?
回答1:
By default this isn't done. The default implementation for the MDI child windows just draws the windows in the old style.
When looking into the source code of the MFC Next stuff, it should be possible to implement it via OnNcPaint.
CMDIChildWndEx already implements OnNcPaint. And when you use a style that returns TRUE on CMFCVisualManager::GetInstance()->IsOwnerDrawCaption() the caption and the frame is already drawn by the visual manager.
All components are there. Maybe it is sufficient to force m_Impl.OnNcPaint always to be called. So create your own MDI Child window class and force the MDI system to use it. (See your doc template class).
If this isn't enough you can call all components of the visualizer to draw the frame by yourself.
PS: I just rechecked it in the BCG implementation and it was possible for me to show the MDI child windows in a different style.
来源:https://stackoverflow.com/questions/33297775/cmdichildwnd-look-feel-on-windows-10