CListViewCtrlEx类的使用方法:创建Expandable Item Group

使用这个控件功能倒是实现了,就是API有些不太友好,而且用户还需要指定rcOffset之类的细节东东,有时间需要改改。

创建Expandable Item Group的方法:(API有些诡异)

        //ATL::_U_MENUorID
        m_DllErrList->Create(m_hWnd, &rcList, NULL, WS_VISIBLE | WS_CHILD | LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SINGLESEL | WS_BORDER | LVS_OWNERDRAWFIXED, 0, 0U, NULL);
        
        m_DllErrList->InsertColumn(0, L"Type", LVCFMT_LEFT, 200);
        m_DllErrList->InsertColumn(1, L"File Name", LVCFMT_LEFT, 200);
        m_DllErrList->InsertColumn(2, L"Size", LVCFMT_LEFT, 200);
        m_DllErrList->InsertColumn(3, L"Version", LVCFMT_LEFT, 200);
        m_DllErrList->InsertColumn(4, L"Path", LVCFMT_LEFT, 200);

        //first expandable item group
        int nItem = m_DllErrList->AppendTitle(L".dll", 0, LISTITEM_TITLE|LISTITEM_EXPANDABLE);  //LISTITEM_TITLE
        nItem = m_DllErrList->Append(L"");
        m_DllErrList->AppendSubItem(nItem, L"TestName", SUBITEM_TEXT);
        m_DllErrList->AppendSubItem(nItem, L"TestFileName", SUBITEM_TEXT);
        m_DllErrList->AppendSubItem(nItem, L"TestSize", SUBITEM_TEXT);
        m_DllErrList->AppendSubItem(nItem, L"TestVersion", SUBITEM_TEXT);
        m_DllErrList->AppendSubItem(nItem, L"TestPath", SUBITEM_TEXT);

        nItem = m_DllErrList->Append(L"");
        m_DllErrList->AppendSubItem(nItem, L"TestName", SUBITEM_TEXT);
        m_DllErrList->AppendSubItem(nItem, L"TestFileName", SUBITEM_TEXT);
        m_DllErrList->AppendSubItem(nItem, L"TestSize", SUBITEM_TEXT);
        m_DllErrList->AppendSubItem(nItem, L"TestVersion", SUBITEM_TEXT);
        m_DllErrList->AppendSubItem(nItem, L"TestPath", SUBITEM_TEXT);

        //another expandable  item group
        m_DllErrList->AppendTitle(L".sys", 0, LISTITEM_TITLE|LISTITEM_EXPANDABLE);  //LISTITEM_TITLE
        nItem = m_DllErrList->Append(L"");
        m_DllErrList->AppendSubItem(nItem, L"TestName", SUBITEM_TEXT);
        m_DllErrList->AppendSubItem(nItem, L"TestFileName", SUBITEM_TEXT);
        m_DllErrList->AppendSubItem(nItem, L"TestSize", SUBITEM_TEXT);
        m_DllErrList->AppendSubItem(nItem, L"TestVersion", SUBITEM_TEXT);
        m_DllErrList->AppendSubItem(nItem, L"TestPath", SUBITEM_TEXT);

        nItem = m_DllErrList->Append(L"");
        m_DllErrList->AppendSubItem(nItem, L"TestName", SUBITEM_PROGRESSBAR);
        m_DllErrList->AppendSubItem(nItem, L"TestFileName", SUBITEM_TEXT);
        m_DllErrList->AppendSubItem(nItem, L"TestSize", SUBITEM_TEXT);
        m_DllErrList->AppendSubItem(nItem, L"TestVersion", SUBITEM_TEXT);
        m_DllErrList->AppendSubItem(nItem, L"TestPath", SUBITEM_TEXT);

 效果:

折叠后:

posted @ 2014-01-21 15:15  Tup  阅读(362)  评论(0)    收藏  举报