CListCtrl(list)怎么用啊。最好给点代码。

devidzdw32 2003-08-19 10:42:41
CListCtrl以前经常用report类型的。现在想用list的不知道怎么用。谢谢指教。
...全文
131 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
fupa0 2003-08-19
  • 打赏
  • 举报
回复
看msdn吧
里面讲的很详细
例程都很经典
孤必有邻 2003-08-19
  • 打赏
  • 举报
回复
// 建立表头

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 );
devidzdw32 2003-08-19
  • 打赏
  • 举报
回复
不过我感觉report和list有差别啊。
lightwell 2003-08-19
  • 打赏
  • 举报
回复
msdn你没的?
devidzdw32 2003-08-19
  • 打赏
  • 举报
回复
谢谢啊。
joy0861 2003-08-19
  • 打赏
  • 举报
回复
下面是这个类的所有成员函数,希望有用。整理了大半天阿。

Construction

CListCtrl //Constructs a CListCtrl object.
Create //Creates a list control and attaches it to a CListCtrl object.


Attributes

GetBkColor //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 mark of a list view control.
SetSelectionMark //Sets the selection mark 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.


Operations

InsertItem //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.


Overridables

DrawItem //Called when a visual aspect of an owner-draw control changes

16,471

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧