SetItemText用法

CListCtrl::SetItemText

BOOL SetItemText( int nItem, int nSubItem, LPTSTR lpszText );

Return Value

Nonzero if successful; otherwise zero.

Parameters

nItem

Index of the item whose text is to be set.

nSubItem

Index of the subitem, or zero to set the item label.

lpszText

Pointer to a string that contains the new item text.

例子:

m_list1.InsertItem(0,"");
 m_list1.SetItemText(0,0 , "1、培训时间");
 m_list1.SetItemText(0,1 , "[  ]");

listctrl 设置风格

//获得原有风格
DWORD dwStyle = ::GetWindowLong(m_listctrl.m_hWnd, GWL_STYLE);
dwStyle &= ~(LVS_TYPEMASK);
dwStyle &= ~(LVS_EDITLABELS);
//设置新风格
SetWindowLong(m_listctrl.m_hWnd, GWL_STYLE,dwStyle, |LVS_REPORT | LVS_NOLABELWRAP | LVS_SHOWSELALWAYS);
//设置扩展风格
DWORD styles = LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES|LVS_EX_CHECKBOXES;
ListView_SetExtendedListViewStyleEx(m_listctrl.m_hWnd, styles, styles );

其中LVS_EX_FULLROWSELECT 就是前面说得整行选中
LVS_EX_GRIDLINES 网格线(只适用与report风格的listctrl)
LVS_EX_CHECKBOXES 前面加个checkbox
pListCtrl->SetExtendedStyle( m_listctrl.GetExtendedStyle() | LVS_EX_SUBITEMIMAGES);

posted on 2011-08-11 10:04  role  阅读(10137)  评论(1编辑  收藏  举报