CListCtrl以前经常用report类型的。现在想用list的不知道怎么用。谢谢指教。

解决方案 »

  1.   

    下面是这个类的所有成员函数,希望有用。整理了大半天阿。ConstructionCListCtrl //Constructs a CListCtrl object. 
    Create //Creates a list control and attaches it to a CListCtrl object. 
    AttributesGetBkColor //Retrieves the background color of a list view control. 
    SetBkColor //Sets the background color of the list view control. 
    GetImageList //Retrieves the handle of an image list used for drawing list view items. 
    SetImageList //Assigns an image list to a list view control. 
    GetItemCount //Retrieves the number of items in a list view control. 
    GetItem //Retrieves a list view item’s attributes. 
    SetItem //Sets some or all of a list view item’s attributes. 
    GetCallbackMask //Retrieves the callback mask for a list view control. 
    SetCallbackMask //Sets the callback mask for a list view control. 
    GetNextItem //Searches for a list view item with specified properties and with specified //relationship to a given item. 
    GetFirstSelectedItemPosition //Retrieves the position of the first selected list view item in a list view control. 
    GetNextSelectedItem //Retrieves the next selected list view item for iterating. 
    GetItemRect //Retrieves the bounding rectangle for an item. 
    SetItemPosition //Moves an item to a specified position in a list view control. 
    GetItemPosition //Retrieves the position of a list view item. 
    GetStringWidth //Determines the minimum column width necessary to display all of a given string. 
    GetEditControl //Retrieves the handle of the edit control used to edit an item’s text. 
    GetColumn //Retrieves the attributes of a control’s column. 
    SetColumn //Sets the attributes of a list view column. 
    GetColumnWidth //Retrieves the width of a column in report view or list view. 
    SetColumnWidth //Changes the width of a column in report view or list view. 
    GetCheck //Retrieves the current display status of the state image associated with an item. 
    SetCheck //Sets the the current display status of the state image associated with an item. 
    GetViewRect //Retrieves the bounding rectangle of all items in the list view control. 
    GetTextColor //Retrieves the text color of a list view control. 
    SetTextColor //Sets the text color of a list view control. 
    GetTextBkColor //Retrieves the text background color of a list view control. 
    SetTextBkColor //Sets the background color of text in a list view control. 
    GetTopIndex //Retrieves the index of the topmost visible item. 
    GetCountPerPage //Calculates the number of items that can fit vertically in a list view control. 
    GetOrigin //Retrieves the current view origin for a list view control. 
    SetItemState //Changes the state of an item in a list view control. 
    GetItemState //Retrieves the state of a list view item. 
    GetItemText //Retrieves the text of a list view item or subitem. 
    SetItemText //Changes the text of a list view item or subitem. 
    SetItemCount //Prepares a list view control for adding a large number of items. 
    SetItemData //Sets the item’s application-specific value. 
    GetItemData //Retrieves the application-specific value associated with an item. 
    GetSelectedCount //Retrieves the number of selected items in the list view control. 
    SetColumnOrderArray //Sets the column order (left to right) of a list view control. 
    GetColumnOrderArray //Retrieves the column order (left to right) of a list view control. 
    SetIconSpacing //Sets the spacing between icons in a list view control. 
    GetHeaderCtrl //Retrieves the header control of a list view control. 
    GetHotCursor //Retrieves the cursor used when hot tracking is enabled for a list view control. 
    SetHotCursor //Sets the cursor used when hot tracking is enabled for a list view control. 
    GetSubItemRect //Retrieves the bounding rectangle of an item in a list view control. 
    GetHotItem //Retrieves the list view item currently under the cursor. 
    SetHotItem //Sets the current hot item of a list view control. 
    GetSelectionMark //Retrieves the selection  of a list view control. 
    SetSelectionMark //Sets the selection  of a list view control. 
    GetExtendedStyle //Retrieves the current extended styles of a list view control. 
    SetExtendedStyle //Sets the current extended styles of a list view control. 
    SubItemHitTest //Determines which list view item, if any, is at a given position. 
    GetWorkAreas //Retrieves the current working areas of a list view control. 
    GetNumberOfWorkAreas //Retrieves the current number of working areas for a list view control. 
    SetItemCountEx //Sets the item count for a virtual list view control. 
    SetWorkAreas //Sets the area where icons can be displayed in a list view control. 
    ApproximateViewRect //Determines the width and height required to display the items of a list view control. 
    GetBkImage //Retreives the current background image of a list view control. 
    SetBkImage //Sets the current background image of a list view control. 
    GetHoverTime //Retrieves the current hover time of a list view control. 
    SetHoverTime //Sets the current hover time of a list view control. 
    OperationsInsertItem //Inserts a new item in a list view control. 
    DeleteItem //Deletes an item from the control. 
    DeleteAllItems //Deletes all items from the control. 
    FindItem //Searches for a list view item having specified characteristics. 
    SortItems //Sorts list view items using an application-defined comparison function. 
    HitTest //Determines which list view item is at a specified position. 
    EnsureVisible //Ensures that an item is visible. 
    Scroll //Scrolls the content of a list view control. 
    RedrawItems //Forces a list view control to repaint a range of items. 
    Update //Forces the control to repaint a specified item. 
    Arrange //Aligns items on a grid. 
    EditLabel //Begins in-place editing of an item’s text. 
    InsertColumn //Inserts a new column in a list view control. 
    DeleteColumn //Deletes a column from the list view control. 
    CreateDragImage //Creates a drag image list for a specified item. 
    OverridablesDrawItem //Called when a visual aspect of an owner-draw control changes 
      

  2.   

    不过我感觉report和list有差别啊。
      

  3.   

    // 建立表头ctrl.InsertColumn( 0, "序号", LVCFMT_LEFT, 40, -1 );
    ctrl.InsertColumn( 1, "主叫号码", LVCFMT_LEFT, 100, -1 );
    ctrl.InsertColumn( 2, "时间", LVCFMT_LEFT, 120, -1 );
    ctrl.InsertColumn( 3, "编号", LVCFMT_LEFT, 70, -1 );
    ctrl.InsertColumn( 4, "设备编号", LVCFMT_LEFT, 70, -1 );// 插入数据char buf[8]="abcdefg";
    ctrl.InsertItem( 1, buf );
    ctrl.SetItem( 0, 1, LVIF_TEXT, buf, 0, 0, 0, 0 );
    ctrl.SetItem( 0, 2, LVIF_TEXT, buf, 0, 0, 0, 0 );
      

  4.   

    看msdn吧
    里面讲的很详细
    例程都很经典