I'm making a MFC SDI project.
There is a main view which i want to maximize, but I don't know how to do it.
(I succeeded to maximized main frame window, but failed to maximized the formview like below image.)
[enter image description here][2]
BOOL CProjectNameApp::InitInstance()
{
...
m_pMainWnd->ShowWindow(SW_SHOWMAXIMIZED);
m_pMainWnd->UpdateWindow();
return TRUE;
}
void CProjectNameView::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
//GetParentFrame()->RecalcLayout(TRUE);
//ResizeParentToFit(FALSE);
}
These are the final things that i did so far.
I wrote m_pMainWnd->ShowWindow(SW_SHOWMAXIMIZED);
to maximized main window,
and annotation two lines (GetParentFrame()->RecalcLayout(TRUE);
and ResizeParentToFit(FALSE);
) to the formview to fit the main frame.
I already searched on google and stackoverflow and read many answers but nothing helps me.. How can i solve this problem?
(+) The base class of mainview(ProjectNameView) is CFormview, not CView. And sorry for my poor english.
[2]: https://i.stack.imgur.com/dFMEY.png
GetWindow()
). TheRecalcLayout()/ResizeParentToFit()
technique is used to resize the main window so that it fits the form exactly - and of course it has no meaning if the main window is maximized. – Constantine GeorgiouGetWindow()
. Thank you – user530530