How do I to change CMDIChildWnd's client area?
-
By default, CMDIChildWnd use all its client area for a CView object, but I want leave some space to place another things, for example RulerBars, what can i do for it? Someone suggested me use two CDialogBars to implement it,but I don't think it is a good way, because the dialogbars can't overlap each other. I want to set view orgin at CPoint(16,16) relative to ChildWnd's client area orgin. What can i do for it?
-
By default, CMDIChildWnd use all its client area for a CView object, but I want leave some space to place another things, for example RulerBars, what can i do for it? Someone suggested me use two CDialogBars to implement it,but I don't think it is a good way, because the dialogbars can't overlap each other. I want to set view orgin at CPoint(16,16) relative to ChildWnd's client area orgin. What can i do for it?
You should handle WM_SIZE and do the layout there. Try something like this: void CChildFrame::OnSize(UINT nType, int cx, int cy) { // CMDIChildWnd::OnSize(nType, cx, cy); CWnd::OnSize(nType, cx, cy); CWnd* pView = GetDlgItem(AFX_IDW_PANE_FIRST); if (pView != NULL) pView->MoveWindow(16, 16, cx - 16, cy - 16); GetMDIFrame()->OnUpdateFrameTitle(TRUE); } In this way, you get the space for the other controls. You can even paint the rulers directly in the frame's client area and not use controls. I would suggest you to use CControlBar-derived rulers too, but you decide.