Create a new MFC project.
are as follows:
Maximize and minimize each turn on. This is the program.
How to let the program follow the size itself changes. Add a variable to the control first.
Add a response message to the window at the same time.
voidCghostdlg::onsize (UINT NType,intCxintcy) {cdialogex::onsize (NType, CX, CY); if(M_list_oline.m_hwnd!=null)//Change the on- line address size{CRect rc; Rc.left=1;//the left coordinate of the listrc.top= the;//top coordinates of the listrc.right=cx-1;//the right coordinate of the listrc.bottom=cy- the;//bottom coordinate of the listM_list_oline. MoveWindow (RC); } if(M_list_msg.m_hwnd!=null)//change the size of the log box{CRect rc; Rc.left=1;//the left coordinate of the listrc.top=cy-156;//top coordinates of the listrc.right=cx-1;//the right coordinate of the listrc.bottom=cy-6;//bottom coordinate of the listm_list_msg. MoveWindow (RC); } //todo:add your message handler code here}
Finally, we find that the window has a problem with small changes. So we need to move our hands in the initialization window.
CRect rect; GetWindowRect (&rect); Rect.bottom+=; MoveWindow (rect);
Well, then it's finished. Look at the results.
No matter how large our program is, the size of the control changes.
Learning Remote Control Interface Design One: program Interface size