C#的ListView列宽度自动 [英] C# ListView Column Width Auto

查看:1420
本文介绍了C#的ListView列宽度自动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何设置C#的WinForms 列表视图控制自动列宽。喜欢的东西宽度= -1 / -2?

How can I set the column width of a c# winforms listview control to auto. Something like width = -1 / -2 ?

推荐答案

您答曰:-2将列自动调整列标题文本的长度,-1将自动调整到最长的项目在列。 所有根据MSDN 。但请注意,在-1的情况下,您将需要添加的项目(S)后设置列宽。所以,如果你添加一个新的项目,您还需要指定列的宽度属性(或列)要按照的ListView 控制数据自动调整大小。

You gave the answer: -2 will autosize the column to the length of the text in the column header, -1 will autosize to the longest item in the column. All according to MSDN. Note though that in the case of -1, you will need to set the column width after adding the item(s). So if you add a new item, you will also need to assign the width property of the column (or columns) that you want to autosize according to data in ListView control.

这篇关于C#的ListView列宽度自动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆