List View Crack
时间:2011-03-19 来源:LeeCe
条目数, 性能优化
ListView_SetItemCount
ListView_SetItemCountEx
LVM_SETITEMCOUNT
LVM_GETITEMCOUNT ListView_GetItemCount
提前分配够数量, 避免1条1条分配空间,使得速度提升。
item结构: icon, label, subitem
icon label | subitem | subitem
添加, 修改, 删除, 检索
LVM_INSERTITEM
ListView_InsertItem LVM_SETITEMTEXT
ListView_SetItemText
LVM_DELETEITEMListView_DeleteItem
LVM_GETITEMListView_GetItem
ListView_GetItem
CString str1;
LV_ITEM itemInfo = {0}; // Initialize to 0, pretty important!
itemInfo.iItem = 0;
itemInfo.iSubItem = 0;
itemInfo.mask = LVIF_TEXT;
itemInfo.cchTextMax = 256;
itemInfo.pszText = str1.GetBuffer(itemInfo.cchTextMax+1);
ListView_GetItem(hList, &itemInfo);
str1.ReleaseBuffer();
修改状态
点击header排序
在list-view parent中
LRESULT CMainDlg::HandleWM_NOTIFY(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/)
{
NMLVDISPINFO* plvdi;
switch (((LPNMHDR) lParam)->code)
{
case LVN_GETDISPINFO:
plvdi = (NMLVDISPINFO*) lParam;
switch (plvdi->item.iSubItem)
{
case 0:
plvdi->item.pszText = rgPetInfo[plvdi->item.iItem].szKind;
break;
case 1:
plvdi->item.pszText = rgPetInfo[plvdi->item.iItem].szBreed;
break;
default:
break;
}
break;
case LVN_COLUMNCLICK:
int k = 0; ...
break;
break;
}
相关阅读 更多 +