要求:建立一个但文档工程,在启动后的主窗口里动态的加一个CListCtrl控件,按LVS_EPRORT风格显示
要源代码,窗口建立没问题就给分
.nc

解决方案 »

  1.   

    如上,选择视图的继承类,就NO PROBLEN
      

  2.   

    在单文档工程启动时的视里加入CListCtrl,启动时能看到就可以
      

  3.   

    建立一个基类为CListView的单文档工程
      

  4.   

    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.编译后就可以看到效果了