上的WinForms ListView控件的多线列表中的项目?控件、项目、列表中、WinForms

2023-09-02 21:35:19 作者:Lemon(柠檬)

有没有办法来显示标准的WinForms ListView控件的多行文字?

Is there a way to display multi-line text in standard Winforms listview control?

谢谢, 凯末尔

推荐答案

如果你想在一个ListView多行文本,看看的 ObjectListView (一个开源围绕.NET的WinForms ListView的包装)。这需要许多涉及所有者绘制(和其他的ListView烦恼)的问题负责。

If you want multi-line text in a ListView, have a look at ObjectListView (an open source wrapper around .NET WinForms ListView). This takes care of many of the problems involved with owner drawing (and other ListView annoyances).

在下面的截图,第一列自动换行打开:

In the following screenshot, the first column has WordWrap turned on:

请记住,一个ListView 不能有行不同的高度。在上面的截图,我不能让第一个和第三个行高,显示更多的文字,其他行短。每一行必须是相同的高度。

Just remember that a ListView CANNOT have rows of different heights. In the above screenshot, I cannot make the first and third rows taller to show more text and the other rows shorter. Every row has to be the same height.

如果能够有不同的行高度是必不可少的你,一个ListView不会将您的解决方案。您可能要考虑马修·霍尔的优秀XPTable 和的其更新项目,还有的