m_ChListCtrl.Create(WS_CHILD|WS_VISIBLE|LVS_REPORT,
                        rt,this,LIST_CONTROL);
创建后
m_ChListCtrl.InsertColumn(0,"Serial",
                0,1/4.0*(rt.right-rt.left),-1);
m_ChListCtrl.InsertColumn(1,"Channel Name",
                0,3/4.0*(rt.right-rt.left),-1);
插入两列但是我
m_ChListCtrl.InsertItem(0,"1");
m_ChListCtrl.InsertItem(1,"jfklred");
m_ChListCtrl.InsertItem(0,"2");
m_ChListCtrl.InsertItem(1,"jfkld765");全都显示到了第一列
 
2
jfkld765
1
jfklred为什么?

解决方案 »

  1.   

    MFC本来就是这么设计的,你要显示在其列,需要使用SetItemText或SetItemData
      

  2.   

    m_ChListCtrl.InsertItem(0,"");//插入第一行
    m_ChListCtrl.InsertItem(0,1,"2");//设置第一行第一列数据
    m_ChListCtrl.InsertItem(0,2,"jfklred");//设置第一行第二列数据
      

  3.   

    不好意思,错了
    m_ChListCtrl.InsertItem(0,"");//插入第一行
    m_ChListCtrl.SetItemText(0,1,"2");//设置第一行第一列数据
    m_ChListCtrl.SetItemText(0,2,"jfklred");//设置第一行第二列数据
      

  4.   

    insertitem是插入一行。。int nRow;
    nRow = m_ChListCtrl.InsertItem(0,"1");
    m_ChListCtrl.SetItemText(nRow, 1, "jfklred");nRow = m_ChListCtrl.InsertItem(1,"2");
    m_ChListCtrl.SetItemText(nRow, 1, "jfkld765");