Home > Software engineering >  Bosses, use the wizard to generate single document and no document/view architecture support program
Bosses, use the wizard to generate single document and no document/view architecture support program

Time:11-15

The early application of generated three CPP file, respectively is MainFrm CPP, ChildView. CPP and a project name. CPP, adjust the size of the window where ah, help!

CodePudding user response:

CMainFrame: :
Cx, afx_msg void OnSize (UINT nType, int int cy);
ON_WM_SIZE ()
Void CMainFrame: : OnSize (UINT nType, cx, int int cy)
{
CFrameWnd: : OnSize (cx, nType, cy);
CRect rc;
M_wndToolBar. GetWindowRect (& amp; Rc);
M_ToolBarHeight=rc. Height ();//24 + GetSystemMetrics (SM_CYEDGE);
//
M_frmWidth=cx.
M_frmHeight=cy - m_ToolBarHeight + 1;
M_frmChildX=cx/m_CurrentRow;
M_frmChildY=m_frmHeight/m_CurrentCol;
//TODO: Add your message handler code here
}

CodePudding user response:

reference 1st floor schlafenhamster response:
CMainFrame:
in:Cx, afx_msg void OnSize (UINT nType, int int cy);
ON_WM_SIZE ()
Void CMainFrame: : OnSize (UINT nType, cx, int int cy)
{
CFrameWnd: : OnSize (cx, nType, cy);
CRect rc;
M_wndToolBar. GetWindowRect (& amp; Rc);
M_ToolBarHeight=rc. Height ();//24 + GetSystemMetrics (SM_CYEDGE);
//
M_frmWidth=cx.
M_frmHeight=cy - m_ToolBarHeight + 1;
M_frmChildX=cx/m_CurrentRow;
M_frmChildY=m_frmHeight/m_CurrentCol;
//TODO: Add your message handler code here
}
my new CFrameWnd class didn't seem so much m_ variable

CodePudding user response:

This is an example according to need

CodePudding user response:

Drag the border will have the news

CodePudding user response:

If it is his definition of variables, the light to change the value of the variable did not avail without function should be?

CodePudding user response:

There is no function? RedrawWindow?

CodePudding user response:

If at first the size:
BOOL CMainFrame: : PreCreateWindow (CREATESTRUCT& Cs)
{
If (! CFrameWnd: : PreCreateWindow (cs))
Return FALSE;
//TODO: Modify the Window class or styles here by modifying the
//the CREATESTRUCT cs
CRect winRc,0,800,450 (0);//"bg" add=49; 800 + 49=849
AdjustWindowRect (& amp; WinRc WS_CAPTION, TRUE);
Cs. Cx=winRc. Width ();
Cs. Cy=winRc. Height ();
//
Return TRUE;
}

CodePudding user response:

The
reference 7 floor schlafenhamster response:
if at first the size:
BOOL CMainFrame: : PreCreateWindow (CREATESTRUCT& Cs)
{
If (! CFrameWnd: : PreCreateWindow (cs))
Return FALSE;
//TODO: Modify the Window class or styles here by modifying the
//the CREATESTRUCT cs
CRect winRc,0,800,450 (0);//"bg" add=49; 800 + 49=849
AdjustWindowRect (& amp; WinRc WS_CAPTION, TRUE);
Cs. Cx=winRc. Width ();
Cs. Cy=winRc. Height ();
//
Return TRUE;
}
thank you very much, the original cx CREATESTRUCT structure and xy variables, ignored, before such a direct change really is very simple,

CodePudding user response:

Found in your App class BOOL CXXXApp: : InitInstance () function, modify the main window display code, can maximize,
PMainFrame - & gt; ShowWindow (SW_MAXIMIZE);

Or use MoveWindows directly below to adjust the position, the code is as follows:
PMainFrame - & gt; ShowWindow (m_nCmdShow);
PMainFrame - & gt; UpdateWindow ();

CRect the rect (200, 200, 1200, 1000);
PMainFrame - & gt; MoveWindow (the rect);

CodePudding user response:

references 9 f xsc2001 response:
found in your App class BOOL CXXXApp: : InitInstance () function, modify the main window display code, can maximize,
PMainFrame - & gt; ShowWindow (SW_MAXIMIZE);

Or use MoveWindows directly below to adjust the position, the code is as follows:
PMainFrame - & gt; ShowWindow (m_nCmdShow);
PMainFrame - & gt; UpdateWindow ();

CRect the rect (200, 200, 1200, 1000);
PMainFrame - & gt; MoveWindow (the rect);
thank you very much! This method is really feasible,