小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

MFC表格控件的簡單使用

 寂靜如河 2012-02-20

一、VS2008建立基于對話框的MFC程序,添加List控件,添加控件變量m_List,CListCtrl型

二、設(shè)置格式

[c-sharp] view plaincopy?
  1. m_List.ModifyStyle( 0, LVS_REPORT );               // 報表模式   
  2. m_List.SetExtendedStyle(m_List.GetExtendedStyle() | LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT);  
  3.                                                       // 間隔線+行選中  
 三、插入表頭

  1. m_List.InsertColumn(0,"端口號");  
  2. m_List.InsertColumn(1,"IP");  
 

四、設(shè)置列寬

  1. CRect rect;  
  2. m_List.GetClientRect(rect); //獲得當前客戶區(qū)信息   
  3. m_List.SetColumnWidth(0, rect.Width() / 2); //設(shè)置列的寬度。   
  4. m_List.SetColumnWidth(1, rect.Width() / 2);  
 五、插入行數(shù)據(jù)

  1. m_List.InsertItem(0, "2354");  
  2. m_List.SetItemText(0, 1, "192.168.0.2");  

六、查找第一列數(shù)據(jù)

  1. LVFINDINFO info;  
  2. int nIndex;  
  3. info.flags = LVFI_PARTIAL|LVFI_STRING;  
  4. info.psz = "1234";  
  5. nIndex = m_List.FindItem(&info)  // nIndex為行數(shù)(從0開始)  

七、查找其他列數(shù)據(jù)需遍歷

  1. int nRows = 0;  
  2. nRows = m_List.GetItemCount();  
  3. int nIndex = 0;  
  4. for(int i = 0; i < nRows; i++)  
  5. {  
  6.     if(m_List.GetItemText(i, 5).Find("1234") >= 0)  
  7.     {  
  8.         nIndex = i;  
  9.     }  
  10. }  

八、刪除一行

  1. m_List.DeleteItem(nIndex);  

    本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導購買等信息,謹防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報。
    轉(zhuǎn)藏 分享 獻花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多