CListCtrl用法

来源:互联网 发布:有500万怎么投资知乎 编辑:程序博客网 时间:2024/05/16 15:29

1

The CListCtrl class encapsulates the functionality of a “list view control,” which displays a collection of items each consisting of an icon (from an image list) and a label. In addition to an icon and label, each item can have information displayed in colums to the right of the icon and label.

解释: item = icon + label + 右面的N个项..

          label = 第一列.

 

2

int column;

 column = m_list.InsertColumn( 0, "ID", LVCFMT_LEFT, 40 );//插入列
 column = m_list.InsertColumn( 1, "NAME", LVCFMT_LEFT, 50 );

 

解释: InsertColumn的第一个参数是你想要插入的列的值, 如果函数不能在你指定的列插入, 它会选择一个合适的列插入,然后利用返回值告诉你实际插入的列号.

 

3

int nRow = m_list.InsertItem(0, "11");//插入行
 m_list.SetItemText(nRow, 1, "jacky");//设置数据
 m_list.SetItemText(nRow, 2, "男");

原创粉丝点击