本帖最后由 hhkun0120 于 2011-01-05 17:56:59 编辑

解决方案 »

  1.   

    其实这是个简单的图形,我拖出来的几个list和几个button。如何在list中显示数据呢?代码应该如何修改呢?
      

  2.   

    这个问题可以简化为,CString=“BBBBB”;怎么样让这个CString在LISTBOX中显示出来?
      

  3.   

    CListBox m_listbox;
    CString str="BBBB";
    m_listbox.AddString(str);
      

  4.   

    1.在list的最后增加元素
    CListBox::AddString 
    int AddString( LPCTSTR lpszItem );
    2.在list的指定位置插入元素
    CListBox::InsertString 
    int InsertString( int nIndex, LPCTSTR lpszItem );
      

  5.   

    让 CListBox 控件成为窗体成员。
    然后
    CString str="BBBB";
    m_listbox.AddString(str);
      

  6.   

    AddString然后UpdateData(false)....???
      

  7.   

    CListBox* plst = (CListBox*)GetDlgItem(IDC_LIST1);
    plst->AddString("test1");
    你把listbox拖到你的对话框里的时候,在属性窗口里看看他的id。这儿的IDC_LIST1就是listbox的id
      

  8.   

    要给ListBox关联控制变量
    然后InsertString
      

  9.   

    CListBox类对象关联你的ListBox窗口对象,然后调用
    CListBox::AddString()就可以添加数据了