1.建立一个单文档工程,注意:在最后一步中,把XXXview的基类改为CListView 2.在PreCreateWindow(CREATESTRUCT& cs)中加上 cs.style|=LVS_REPORT; 当然是在那行return 之前了 3.在函数OnInitialUpdate()内,在 // TODO: You may populate your ListView with items by directly accessing // its list control through a call to GetListCtrl(). 之后加上如下语句: this->GetListCtrl().InsertColumn(0,TEXT("one"),LVCFMT_CENTER,100); this->GetListCtrl().InsertColumn(1,TEXT("two"),LVCFMT_CENTER,100); this->GetListCtrl().InsertItem(0,TEXT("forexmple one")); this->GetListCtrl().SetItemText(0,1,TEXT("the fourth linebbv")); 4.编译后就可以看到效果了
2.在PreCreateWindow(CREATESTRUCT& cs)中加上
cs.style|=LVS_REPORT;
当然是在那行return 之前了
3.在函数OnInitialUpdate()内,在
// TODO: You may populate your ListView with items by directly accessing
// its list control through a call to GetListCtrl().
之后加上如下语句:
this->GetListCtrl().InsertColumn(0,TEXT("one"),LVCFMT_CENTER,100);
this->GetListCtrl().InsertColumn(1,TEXT("two"),LVCFMT_CENTER,100);
this->GetListCtrl().InsertItem(0,TEXT("forexmple one"));
this->GetListCtrl().SetItemText(0,1,TEXT("the fourth linebbv"));
4.编译后就可以看到效果了