在Winform中,要设置TreeListView的样式,你需要使用ObjectListView库
// 设置列标题
this.treeListView1.Columns.Add(new OLVColumn("Name", "Name"));
this.treeListView1.Columns.Add(new OLVColumn("Size", "Size"));
this.treeListView1.Columns.Add(new OLVColumn("Date Modified", "DateModified"));
// 设置列宽
this.treeListView1.Columns[0].Width = 200;
this.treeListView1.Columns[1].Width = 100;
this.treeListView1.Columns[2].Width = 150;
// 设置列对齐方式
this.treeListView1.Columns[1].TextAlign = HorizontalAlignment.Right;
// 设置行高
this.treeListView1.RowHeight = 22;
// 设置树形线条风格
this.treeListView1.TreeLinePen = new Pen(Color.Gray, 1);
// 设置选中行的背景色和前景色
this.treeListView1.SelectedBackColor = Color.LightBlue;
this.treeListView1.SelectedForeColor = Color.Black;
// 设置鼠标悬停行的背景色和前景色
this.treeListView1.HotTrackingColor = Color.Orange;
this.treeListView1.HotTrackingOverlayImage = null;
// 设置行的边框
this.treeListView1.CellEditUseWholeCell = false;
this.treeListView1.GridLines = true;
this.treeListView1.GridLineColor = Color.FromArgb(224, 224, 224);
// 设置行的背景色
this.treeListView1.AlternateRowBackColor = Color.FromArgb(240, 240, 240);
// 设置滚动条样式
this.treeListView1.VScrollBar.LargeChange = 10;
this.treeListView1.VScrollBar.SmallChange = 1;
这只是一些基本的样式设置,你可以根据需要进行更多的自定义。更多关于ObjectListView的信息和示例,请参考官方文档:http://objectlistview.sourceforge.net/cs/index.html