for(i = 0; i < 5; i++)
{
lvcolumn.mask = LVCF_FMT | LVCF_SUBITEM | LVCF_TEXT | LVCF_WIDTH | LVCF_ORDER;
lvcolumn.fmt = LVCFMT_LEFT;
lvcolumn.pszText = rgtsz[i];
lvcolumn.iSubItem = i;
lvcolumn.iOrder = i;
lvcolumn.cx = rect.Width() / 4;
m_ListCtrl.InsertColumn(i, &lvcolumn);
}
{
lvcolumn.mask = LVCF_FMT | LVCF_SUBITEM | LVCF_TEXT | LVCF_WIDTH | LVCF_ORDER;
lvcolumn.fmt = LVCFMT_LEFT;
lvcolumn.pszText = rgtsz[i];
lvcolumn.iSubItem = i;
lvcolumn.iOrder = i;
lvcolumn.cx = rect.Width() / 4;
m_ListCtrl.InsertColumn(i, &lvcolumn);
}
CListCtrl *theCtrl = &GetListCtrl();
theCtrl->InsertColumn(0, _T("Player Name"), LVCFMT_LEFT);
theCtrl->InsertColumn(0, _T("Jersey Number"),LVCFMT_LEFT);
这样就行了。
在precreatewindow里面修改ListView的风格。
直接加一行
theCtrl.ModifyStyle(LVS_ICON | LVS_SMALLICON | LVS_LIST, LVS_REPORT);
也可以。