C#ListView控件如何改变行高
2020-06-18 本文已影响0人
堆石成山
本身listview控件没有设置行高的属性,但是可以通过imagelist来把行“撑”高.
创建一个imagelist,修改图片大小原本是16x16,可以更改为25x25.


或者直接代码创建一个25*25大小的imagelist。然后赋值给listview的SmallmageList即可。如下代码:
ImageList imagelist1 = new ImageList();
imagelist1.ImageSize = new Size(25, 25);
tlvParameter.SmallImageList = imagelist1;
System.Windows.Forms.ListView listView1 = new System.Windows.Forms.ListView();
listView1.SmallImageList= imagelist1;
图中是treelistView控件,更改行高与listview效果一样。
更改前:

更改后:
