The listctrl control automatically adapts to the window size.

Source: Internet
Author: User

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
}

}

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.