MFC可視化 清單控制項的使用

來源:互聯網
上載者:User

標籤:des   style   blog   http   ext   com   

1、應該加入標頭檔

 #include <Atlbase.h> 2、樣本   類嚮導給清單控制項綁定變數m_list

DWORD 
 dwExStyle=LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES|LVS_EX_HEADERDRAGDROP|LVS_EX_ONECLICKACTIVATE|LVS_EX_FLATSB;  

m_list.ModifyStyle(0,LVS_REPORT|LVS_SINGLESEL|LVS_SHOWSELALWAYS);
m_list.SetExtendedStyle(dwExStyle);

m_list.InsertColumn(0,"姓名",LVCFMT_LEFT,40);m_list.InsertColumn(1,"性別",LVCFMT_LEFT,40);m_list.InsertColumn(2,"年齡",LVCFMT_LEFT,40);m_list.InsertColumn(3,"年級",LVCFMT_LEFT,40);m_list.InsertItem(0,"張三");m_list.InsertItem(1,"李四");m_list.InsertItem(2,"王五");CString str1,str2,str3;str1="男";str2="20";str3="三年級";m_list.SetItemText(0,1,str1);m_list.SetItemText(0,2,str2);m_list.SetItemText(0,3,str3);   LV_ITEM lvItem;
  lvItem.mask=LVIF_TEXT;
  lvItem.iSubItem=0;
  lvItem.pszText="";for(i=0; i<Rnumber; i++)
    {
  
        for(int j=0; j<Rnum[i]; j++)
  {
   lvItem.iItem=j;   
    str1=R[i][j].des_ip.c_str();
    //MessageBox(str1);
    
    str2=R[i][j].next_ip.c_str();
    str3.Format("%d",R[i][j].jump_num);
    m_list1.InsertItem(&lvItem);
    m_list1.SetItemText(j,0,str1);
    m_list1.SetItemText(j,1,str2);
    m_list1.SetItemText(j,2,str3);
   }}http://www.cppblog.com/finehai/archive/2009/09/17/96574.html

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.