InsertItem的用法

来源:互联网 发布:adobe ae 2015 mac 编辑:程序博客网 时间:2024/06/05 08:41
listcontrol实例:InsertItem用法。
extern CListCtrl* pmyListCtrl;
CString strText;
int nColumnCount = pmyListCtrl->GetHeaderCtrl()->GetItemCount(); // Insert 10 items in the list view control.
for (int i=0;i < 10;i++) {
strText.Format(TEXT("item %d"), i); // Insert the item, select every other item.
pmyListCtrl->InsertItem( LVIF_TEXT|LVIF_STATE, i, strText, (i%2)==0 ? LVIS_SELECTED : 0, LVIS_SELECTED, 0, 0); // Initialize the text of the subitems.
for (int j=1;j < nColumnCount;j++) {
strText.Format(TEXT("sub-item %d %d"), i, j);
pmyListCtrl->SetItemText(i, j, strText); }
}
0 0
原创粉丝点击