void CMyListViewView::OnInitialUpdate()
{
CListView::OnInitialUpdate();
// TODO: You may populate your ListView with items by directly accessing
// its list control through a call to GetListCtrl().
// this code only works for a report-mode list view
ASSERT(GetStyle() & LVS_REPORT);
CListCtrl& listCtrl = GetListCtrl(); // Insert a column. This override is the most convenient.
listCtrl.InsertColumn(0, _T("Player Name"), LVCFMT_LEFT,-1,-1); // The other InsertColumn() override requires an initialized
// LVCOLUMN structure.
LVCOLUMN col;
col.mask = LVCF_FMT | LVCF_TEXT;
col.pszText = _T("Jersey Number");
col.fmt = LVCFMT_LEFT;
listCtrl.InsertColumn(1, &col); // Set reasonable widths for our columns
listCtrl.SetColumnWidth(0, LVSCW_AUTOSIZE_USEHEADER);
listCtrl.SetColumnWidth(1, LVSCW_AUTOSIZE_USEHEADER);
}
第一次使用CListView,不知道如何显示他的列表。
参看了MSDN中的代码,如下
使用单文档APP,但是运行时无法显示并一直报错,是断言出错,而且追不到出错位置,请教高手!
{
CListView::OnInitialUpdate();
// TODO: You may populate your ListView with items by directly accessing
// its list control through a call to GetListCtrl().
// this code only works for a report-mode list view
ASSERT(GetStyle() & LVS_REPORT);
CListCtrl& listCtrl = GetListCtrl(); // Insert a column. This override is the most convenient.
listCtrl.InsertColumn(0, _T("Player Name"), LVCFMT_LEFT,-1,-1); // The other InsertColumn() override requires an initialized
// LVCOLUMN structure.
LVCOLUMN col;
col.mask = LVCF_FMT | LVCF_TEXT;
col.pszText = _T("Jersey Number");
col.fmt = LVCFMT_LEFT;
listCtrl.InsertColumn(1, &col); // Set reasonable widths for our columns
listCtrl.SetColumnWidth(0, LVSCW_AUTOSIZE_USEHEADER);
listCtrl.SetColumnWidth(1, LVSCW_AUTOSIZE_USEHEADER);
}
第一次使用CListView,不知道如何显示他的列表。
参看了MSDN中的代码,如下
使用单文档APP,但是运行时无法显示并一直报错,是断言出错,而且追不到出错位置,请教高手!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货