1.必须设置视图(view)和添加列头,否则不显示。
listView1.View = View.Details; this.listView1.Columns.Add("列标题1", 120, HorizontalAlignment.Left); this.listView1.Columns.Add("列标题2", 120, HorizontalAlignment.Left); this.listView1.Columns.Add("列标题3", 120, HorizontalAlignment.Left); ListViewItem item1 = new ListViewItem(); item1.Text = "0 0"; item1.SubItems.Add("0 1"); item1.SubItems.Add("0 2"); listView1.Items.Add(item1); ListViewItem item2 = new ListViewItem(); item2.Text = "1 0"; item2.SubItems.Add("1 1"); item2.SubItems.Add("1 2"); listView1.Items.Add(item2);
2.隐藏标题头
listView1.HeaderStyle = ColumnHeaderStyle.None;