Condividi tramite


CListCtrl::Create

Creates a list control and attaches it to a CListCtrl object.

virtual BOOL Create(
   DWORD dwStyle,
   const RECT& rect,
   CWnd* pParentWnd,
   UINT nID 
);

Parameters

  • dwStyle
    Specifies the list control's style. Apply any combination of list control styles to the control. See List view window styles in the Windows SDK for a complete list of these styles. Set extended styles specific to a control using SetExtendedStyle.

  • rect
    Specifies the list control's size and position. It can be either a CRect object or a RECT structure.

  • pParentWnd
    Specifies the list control's parent window, usually a CDialog. It must not be NULL.

  • nID
    Specifies the list control's ID.

Return Value

Nonzero if successful; otherwise zero.

Remarks

You construct a CListCtrl in two steps. First, call the constructor and then call Create, which creates the list view control and attaches it to the CListCtrl object.

To apply extended Windows styles to the list control object, call CreateEx instead of Create.

Example

    m_myListCtrl.Create(
        WS_CHILD|WS_VISIBLE|WS_BORDER|LVS_REPORT|LVS_EDITLABELS,
        CRect(10,10,400,200), pParentWnd, IDD_MYLISTCTRL);   

Requirements

Header: afxcmn.h

See Also

Reference

CListCtrl Class

Hierarchy Chart

CListCtrl::CListCtrl

CListCtrl::CreateEx

Other Resources

CListCtrl Members