c#listview添加/删除列 [英] c# listview add/delete column
问题描述
我正在使用c#在visual express中使用listveiw。
I'm using listveiw in visual express with c#.
我的listview列无法正常工作。
My listview column doesn't work properly.
1。 listview现在有5列。
1. listview has 5 columns now.
2。删除第4列。 - 现在listview有4列,第5列的值转移到第4列。
2. delete 4th column. - now listview has 4 columns and values of 5th column shifted to 4th column.
3。另外添加列。 - 现在listview有5列。
3. add column another. - now listview has 5 columns.
4. 结果 - 第4列的值转移到第5列,添加的新列值在第4列不在第5列专栏。
4. result - value of 4th colum shifted to 5th column, and added new column value is in 4th column not in 5th column.
你能帮我解决一下吗?
*源代码
///删除列方法
///添加列方法
推荐答案
我没有看到你在添加专栏。
I don't see you are adding column.
添加列代码应为
// Set to details view.
listView1.View = View.Details;
// Add a column with width 20 and left alignment.
listView1.Columns.Add("File type", 20, HorizontalAlignment.Left);
不知怎的,我在你的代码中没有看到。
Somehow I don't see that in your code.
这很可能是Winform。
This is Winform likely.
chanmm
这篇关于c#listview添加/删除列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!