0

我试图在 MSDN 上找到答案,但失败了。

这是我的代码:

        ListView listView1 = new ListView();
        listView1.Bounds = new Rectangle(new Point(10, 10), new Size(300, 200));

        listView1.View = View.Details;
        listView1.LabelEdit = true; //set here
        listView1.AllowColumnReorder = true;
        listView1.CheckBoxes = true;
        listView1.FullRowSelect = true;
        listView1.GridLines = true; // show as grid
        listView1.Sorting = SortOrder.Ascending;

这只能让我编辑列表视图的第一列。因为只有第一列是每个列表视图项的标签。

我想做的是编辑每个网格(列表视图项)。有什么好的建议吗?

4

1 回答 1

0

试试看:

ListView listView1 = new ListView();
listView1.View = View.Details;
listView1.LabelEdit = true;
listView1.Columns.Add("Item Column", -2, HorizontalAlignment.Left);
listView1.Columns.Add("Column 2", -2, HorizontalAlignment.Left);
listView1.Items.AddRange(new ListViewItem[]{"",""});
listView1.Items.AddRange(new ListViewItem[]{"",""});
.
. (how many items you want to edit)
于 2012-06-17T10:40:41.357 回答