C#中listview用法

使用编辑列添加列标题

为了使listview显示网格线,需将listView1.GridLines = true;

为了使listview能选中单行,需将listView1.FullRowSelect = true;

并将View属性设置为Details。

然后用二维数组添加数据

string[][] xxx = new string[2][];
xxx[0] = new string[] { "1", "2" };
xxx[1] = new string[] { "4", "5" };
for (int i = 0; i < xxx.Length; i++)
{
ListViewItem item = new ListViewItem(xxx[i]);
listView1.Items.Add(item);
}
this.listView1.EndUpdate();

 

posted @ 2022-07-26 18:12  杨咩咩plus  阅读(1042)  评论(0)    收藏  举报