问题描述
有没有理由使用时,为什么 listview1.View = View.Details
我的列表视图将扩大(产生滚动条)时,我想补充项目,但有他们是无形的,但是当我转过来为 listview1.View = View.List
它工作得很好?
Is there a reason why when using listview1.View = View.Details
my listview will expand (generate scrollbars) when I add items but have them be invisible, but when I switch it over to listview1.View = View.List
it works just fine?
不,我认为这真的很重要,但这里是code,我用它来将项目添加到列表视图:
Not that I think that it really matters, but here is the code that I use to add items to the listview:
ListViewItem item1 = new ListViewItem(file[1]);
listView1.Items.Add(item1);
和自动生成的设计师code:
And the autogenerated designer code:
//
// listView1
//
this.listView1.CheckBoxes = true;
this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.Path});
this.listView1.Location = new System.Drawing.Point(12, 44);
this.listView1.Name = "listView1";
this.listView1.Size = new System.Drawing.Size(457, 354);
this.listView1.TabIndex = 7;
this.listView1.UseCompatibleStateImageBehavior = false;
this.listView1.View = System.Windows.Forms.View.Details;
文件是包含在第一个元素(使用调试器检查)。
file is a string array that contains about 50 odd characters in the first element (checked using debugger).
推荐答案
以下code应该工作:
The following code should work:
ColumnHeader columnHeader1=new ColumnHeader();
columnHeader1.Text="Column1";
this.listView1.Columns.AddRange(new ColumnHeader[] { columnHeader1 });
ListViewItem item = new ListViewItem("1");
this.listView1.Items.Add(item);
this.listView1.View = View.Details;
如果它没有我不知道。您正在添加可见?字符串的字符
If it doesn't I have no clue. Are the characters of the string you are adding visible?
这篇关于列表视图项不显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!