谁有ctlistbar控件的语法例子,
包括建item和单击事件代码,传份给我,可否?

解决方案 »

  1.   


    // Example// The pointer to my list view control.
    extern CListCtrl* pmyListCtrl;CString strText;
    int nColumnCount = pmyListCtrl->GetHeaderCtrl()->GetItemCount();// Insert 10 items in the list view control.
    for (int i=0;i < 10;i++)
    {
       strText.Format(TEXT("item %d"), i);   // Insert the item, select every other item.
       pmyListCtrl->InsertItem(
          LVIF_TEXT|LVIF_STATE, i, strText, 
          (i%2)==0 ? LVIS_SELECTED : 0, LVIS_SELECTED,
          0, 0);   // Initialize the text of the subitems.
       for (int j=1;j < nColumnCount;j++)
       {
          strText.Format(TEXT("sub-item %d %d"), i, j);
          pmyListCtrl->SetItemText(i, j, strText);
       }
    }Example// The pointer to my list view control.
    extern CListCtrl* pmyListCtrl;
    // The pointer where the mouse was clicked.
    extern CPoint myPoint;// Select the item the user clicked on.
    UINT uFlags;
    int nItem = pmyListCtrl->HitTest(myPoint, &uFlags);if (uFlags & LVHT_ONITEMLABEL)
    {
       pmyListCtrl->SetItem(nItem, 0, LVIF_STATE, NULL, 0, LVIS_SELECTED, 
          LVIS_SELECTED, 0);
    }
    右键CListCtrl控件,可以增加控件消息响应函数
    其实去搜索引擎,一搜,肯定很多的例子代码。
      

  2.   

    看走眼了,以为是CListCtrl呢,试着把控件,拖送至工具箱中,然后拖到界面上,创建一个它的对象就可以操作它了。