Format 1: Used in a single document window or manually created listctrl
Void ctrade_misview: onsize (uint ntype, int CX, int CY)
{
Cview: onsize (ntype, CX, CY );
// Todo: add your message handler code here
If (m_listctrl) // m_listctrl is the Instance Object of listctrl.
{
Crect rect;
Getclientrect (rect); // directly obtain the user area rect
Rect. Top + = 30; // here is the setting 30 pixels from the top
M_listctrl.movewindow (rect );
}
}
Form 2: Used in the dialog box window
Void cdlglistdlg: onsize (uint ntype, int CX, int CY)
{
Cdialog: onsize (ntype, CX, CY );
// Todo: add your message handler code here
/* Reset the list size */
Cwnd * plist = getdlgitem (idc_list1 );
If (plist)
{
Crect rect;
Getwindowrect (& rect); // obtain the window rect,
Screentoclient (rect); // converts the window size to the user area rect
Plist-> movewindow (& rect, true );
}
}
Form 3: it is also used for a single document or a manually created listctrl file. However, this method remains to be verified.
Void clistcontrolview: onsize (uint ntype, int CX, int CY)
{
Cview: onsize (ntype, CX, CY );
// Todo: add the message processing program code here
If (m_listctrl) // m_listctrl is the Instance Object of listctrl.
{
M_listctrl.movewindow (, CX, CY); // reset the list size
}
}