MFC
리스트 컨트롤(CListCtrl)
냐옹이.
2010. 3. 13. 22:40
구조체
typedef struct _LVITEM { UINT mask; int iItem; int iSubItem; UINT state; UINT stateMask; LPTSTR pszText; int cchTextMax; int iImage; LPARAM lParam; #if (_WIN32_IE >= 0x0300) int iIndent; #endif #if (_WIN32_WINNT >= 0x501) int iGroupId; UINT cColumns; // tile view columns PUINT puColumns; #endif #if (_WIN32_WINNT >= 0x0600) int* piColFmt; int iGroup; #endif } LVITEM, *LPLVITEM;
메소드
- DWORD CListCtrl::SetExtendedStyle(DWORD dwNewStyle);
스타일
- LVS_ICON
- LVS_SMALLICON
- LVS_LIST
- LVS_REPORT
- LVS_EX_FULLROWSELECT
Version 4.70. When an item is selected, the item and all its subitems are highlighted. This style is available only in conjunction with the LVS_REPORT style. - LVS_EX_GRIDLINES
Version 4.70. Displays gridlines around items and subitems. This style is available only in conjunction with the LVS_REPORT style.
예
CListCtrl* pSamiParamList = (CListCtrl*) GetDlgItem(IDC_LIST_SAMIPARAM); TCHAR* data[][2] = { {L"Copyright", L"{Copyright (c) Microsoft Corporation. All rights reserved.}"}, {L"Media", L"{SAMI_Demo.wmv}"}, {L"Metrics", L"{time:ms; duration: 73000;}"}, {L"Spec", L"{MSFT:1.0;}"} }; pSamiParamList->InsertColumn(0, L"Name", LVCFMT_LEFT, 55); pSamiParamList->InsertColumn(1, L"Properties", LVCFMT_LEFT, 150); LV_ITEM item; item.mask = LVIF_TEXT; for (int i = 0; i < sizeof(data)/sizeof(data[0]); i++) { item.iItem = i; item.iSubItem = 0; item.pszText = data[i][0]; pSamiParamList->InsertItem(&item); pSamiParamList->SetItemText(i, 1, data[i][1]); }