The MDI child framework maximizes when it starts

Source: Internet
Author: User
The MDI child framework maximizes when it starts
Method One:
In the CChildFrame::P Recreatewindow (createstruct& cs) function, add the
Cs.style |= ws_visible| Ws_maximize, you can achieve the
Method Two:
Add ActiveFrame message to CChildFrame class with ClassWizard
void cchildframe::activateframe (int ncmdshow)
{
Ncmdshow=sw_maximize;
Cmdichildwnd::activateframe (nCmdShow);
}
Method Three: Add the Oninitupdate member function in the View class Overload:
CMDIChildWnd *pwnd= (CMDIChildWnd *) getparentframe ();
Pwnd->mdimaximize ()//or Pwnd->showwindow (sw_maximize) main window maximize: More trouble: note, 1 if the same as the child frame, Write Cs.style |= only in the PreCreateWindow of the main frame ws_visible| Ws_maximize will find that it does not work, 2 in OnCreate () write ShowWindow (sw_maximize) is problematic, will find that although the boot size is maximized, but the upper right corner mark is maximized, That is, the state at this time is marked as normal under the state, that is, the maximum window and normal when the size becomes the same. 3 PreCreateWindow written in cs.cy = GetSystemMetrics (sm_cyscreen); cs.cx = GetSystemMetrics (Sm_cxscreen); It will be found that the first boot, the screen below the desktop is blocked by the taskbar, followed by the discovery and 21 of the problem, the program window to maximize the minimized state is not a problem, but the normal state is to show the launch of the special size of the screen. 4 Add in OnInitialUpdate () of the View class: Cmainframe* pmainfrm= (CMainFrame *) AfxGetMainWnd ();
Pmainfrm->showwindow (sw_maximize);   does not work. In fact, the problem is in the Imgpro2.cpp cimgpro2app::initinstance () The penultimate 2nd sentence: Pmainframe->showwindow (m_ncmdshow); Comment out this sentence, in turn, use the first several methods to see: 1 still do not work 2 when the program starts, the main frame is maximized (the upper-right corner mark is the restore Mark), but when clicked, the size of the restore is maximized. 3 does not show screen 4 can realize the function.   First to maximize, click on the restore mark, restore to a medium sized window. Or do not put Pmainframe->showwindow (m_nCmdShow), comment out in the Initstance function to set the m_nCmdShow value.
m_ncmdshow=sw_showmaxmized//Maximized can also be achieved.
  Add: 1  If you want a picture to open, the child frame window is the same size as the image. If you only write the->setwindowpos or Movwindow program in the OpenFile, then when you open an image after the frame is maximized, you will find that although the Frame client area has the same border as the image size, the child frame is maximized. The program picture will be a little strange. So the solution is to add a sentence frame->showwindow (sw_normal) before the SetWindowPos, so that the frame is in NORMAL state first. 2 in the normal state, if the window size drag changes, then maximize, then restore, to revert to the size of the drag, that is, the normal state of the window size can be changed. Neither maximization nor minimization. For example, the above said, in the maximum opening of the image, the window size changes, minimize or restore, and then click to maximize the window display is maximized when the size is not the size of the picture. 3 resizing the child frame adjusts the size of the view so that the view window is automatically filled with the child frame size. Because in the program to adjust the size of the view, and then resize the child frame, (let the child frame larger), found useless, view or full of the child frame, if you resize the child frame, and then adjust the view size, you will find that only a portion of the child frame is covered by the view.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.