我建了一个从CListView类继承下来的类CMyListView,但是,下面一段代码运行有错误,运行到ASSERT(GetStyle() & LVS_REPORT);出现中断
CListCtrl * theCtrl;
theCtrl = &GetListCtrl();
void CMyListView::OnInitialUpdate()
{
CListView::OnInitialUpdate();
ASSERT(GetStyle() & LVS_REPORT); // Gain a reference to the list control itself
// Insert a column. This override is the most convenient.
theCtrl->InsertColumn(0, _T("Player Name"), LVCFMT_LEFT); // 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;
theCtrl->InsertColumn(1, &col); // Set reasonable widths for our columns
theCtrl->SetColumnWidth(0, LVSCW_AUTOSIZE_USEHEADER);
theCtrl->SetColumnWidth(1, LVSCW_AUTOSIZE_USEHEADER);}
CListCtrl * theCtrl;
theCtrl = &GetListCtrl();
void CMyListView::OnInitialUpdate()
{
CListView::OnInitialUpdate();
ASSERT(GetStyle() & LVS_REPORT); // Gain a reference to the list control itself
// Insert a column. This override is the most convenient.
theCtrl->InsertColumn(0, _T("Player Name"), LVCFMT_LEFT); // 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;
theCtrl->InsertColumn(1, &col); // Set reasonable widths for our columns
theCtrl->SetColumnWidth(0, LVSCW_AUTOSIZE_USEHEADER);
theCtrl->SetColumnWidth(1, LVSCW_AUTOSIZE_USEHEADER);}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货