我试图在一行中从列表视图项中获取文本而不调整列大小,类似于文本框属性“Multiline”
在下面的图片中,“Descripcion”列正在向产品描述添加“...”,而不是我希望在一行中包含所有描述。
就像是:
Descripcion Precio
-------------------|-------
All the description|
in one single row | 80
-------------------|-------
Another item in one|
single row | 70
-------------------|-------
我只是尝试过这样的事情:
ListViewItem row = new ListViewItem();
row.ListView.Height = 30;
但是row.Height给我一个例外,任何想法怎么做?
为了设置高度你可以使用SmallImageList
,这是一个例子:
private void SetHeight(ListView listView, int height)
{
ImageList imgLst = new ImageList();
imgLst.ImageSize = new Size(1, height);
listView.SmallImageList = imgLst;
}
还要包装你的Column,你可以使用ObjectListView,它是围绕.NET ListView
的开源C#包装器