1,列表控件CListCtrl的使用:
1)添加,删除列表控件中的列。
int InsertColumn(int nCol ;nCol为列的位置,从零开始。
,LPCTSTR lpszColumnHeading ;为显示的列名。
,int nFormat = LVCFMT_LEFT ;为显示对齐方式。
,int nWidth=-1, ;为列宽度,取值-1,表明采用自动设置。
int nSubItem=-1); ;分配给该列的子列索引,取值-1,表明没有子列。
BOOL DeleteColumn(int nCol);
2添加,删除列表项。
int InsertItem(int nItem, ;指明插入项的位置。
lPCTSTR lpszItem, ;为显示字符。
int nImage ;位图序列的索引。
);
CImageList* SetImageList(
CImageList* pImageList, ;
int nImageList ;指定图标的类型。默认为LVSIL_NORMAL。
)
BOOL SetItemText(
int nItem, ;设置的项的位置。
int nSubItem, ;为列的位置。
LPTSTR lpszText, ;为显示字符。
);
3获取选中项
4修改列表控件的不同显示方式。
DWORD
SetExtendedStyle(
DWORD dwNewStyle
);
|