乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      MFC中的列表控件CListCtrl

       fcs_110 2010-09-04
      MFC中的列表控件CListCtrl
      2010-05-10 17:33

      MFC中的列表控件CListCtrl 收藏
      在使用CListCtrl控件Report顯示風(fēng)格時(shí),需要設(shè)置列標(biāo)題信息,否則不能向控件中添加數(shù)據(jù)信息,編輯列標(biāo)題需要

      使用InsertColumn方法:
          m_ListCtrl.InsertColumn(0, "姓名", LVCFMT_LEFT, 150, 0);
          m_ListCtrl.InsertColumn(1, "聯(lián)系電話", LVCFMT_LEFT, 150, 1);


      為CListCtrl控件添加行:
          在CListCtrl控件中添加信息時(shí)不能直接向控件中添加列信息,需要先為控件添加行,使用InsertItem方法:
          m_ListCtrl.InsertItem(0, "");


      為CListCtrl控件添加數(shù)據(jù):
          通過SetItemText方法可以為任意行的任意列添加數(shù)據(jù):
          m_ListCtrl.SetItemText(0, 0, "Name");
          m_ListCtrl.SetItemText(0, 1, "123456");


      設(shè)置CListCtrl控件的擴(kuò)展風(fēng)格:
          使用SetExtendedStyle函數(shù)可以設(shè)置CListCtrl控件的擴(kuò)展風(fēng)格,如顯示方式,畫出網(wǎng)格線等:
          m_ListCtrl.SetExtendedStyle(
                LVS_EX_FLATSB    // 扁平風(fēng)格滾動(dòng)
              | LVS_EX_FULLROWSELECT    // 允許正航選中
              | LVS_EX_HEADERDRAGDROP    // 允許標(biāo)題拖拽
              | LVS_EX_ONECLICKACTIVEATE    // 高亮顯示
              | LVS_EX_GRIDLINES    // 畫出網(wǎng)格線
              );

      單擊CListCtrl控件列標(biāo)題進(jìn)行排序:
          在使用CListCtrl控件的Report顯示風(fēng)格時(shí),要實(shí)現(xiàn)單擊列標(biāo)題進(jìn)行排序需要在控件的LVN_COLUMNCLICK消息的處理函數(shù)中添加SortItem函數(shù):
         

      // Sort the item in reverse alphabetical order.
      static int CALLBACK
      MyCompareProc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
      {
         // lParamSort contains a pointer to the list view control.
         // The lParam of an item is just its index.
         CListCtrl* pListCtrl = (CListCtrl*) lParamSort;
         CString     strItem1 = pListCtrl->GetItemText(lParam1, 0);
         CString     strItem2 = pListCtrl->GetItemText(lParam2, 0);

         return strcmp(strItem2, strItem1);
      }

      void snip_CListCtrl_SortItems()
      {
         // The pointer to my list view control.
         extern CListCtrl* pmyListCtrl;

         // Sort the list view items using my callback procedure.
         pmyListCtrl->SortItems(MyCompareProc, (LPARAM) pmyListCtrl);
      }

       

      本文來自CSDN博客,轉(zhuǎn)載請標(biāo)明出處:http://blog.csdn.net/hejianhua/archive/2007/12/31/2006467.aspx

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

        0條評論

        發(fā)表

        請遵守用戶 評論公約

        類似文章 更多