.net WinForms ListView 控件上的多行列表项?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1673963/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Multi-line list items on WinForms ListView control?
提问by Kemal Erdogan
Is there a way to display multi-line text in standard Winforms listview control?
有没有办法在标准 Winforms 列表视图控件中显示多行文本?
Thanks, Kemal
谢谢,凯末尔
回答by Grammarian
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).
如果您想在 ListView 中使用多行文本,请查看ObjectListView(一个围绕 .NET WinForms ListView 的开源包装器)。这可以解决与所有者绘图(以及其他 ListView 烦恼)有关的许多问题。
In the following screenshot, the first column has WordWrapturned on:
在以下屏幕截图中,第一列已WordWrap打开:
Just remember that a ListView CANNOThave 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不能有不同高度的行。在上面的屏幕截图中,我不能让第一行和第三行更高以显示更多文本,而其他行更短。每一行的高度必须相同。
If being able to have rows of different heights is essential to you, a ListView will not your solution. You may want to consider Matthew Hall's excellent XPTableand its update project, as well as Lee Paul Alexander's fantastic Outlook-style list.
如果能够拥有不同高度的行对您来说至关重要,那么 ListView 将不是您的解决方案。你可能要考虑马修·霍尔的优秀XPTable和其更新项目,以及李保罗亚历山大的神奇的Outlook风格的列表。
回答by Sorin Comanescu
Yes, but only in a owner-drawn listview.
是的,但仅限于所有者绘制的列表视图。
EDIT
编辑
Check these links:
检查这些链接:
http://www.codeproject.com/KB/list/aa_listview.aspx
http://www.codeproject.com/KB/list/aa_listview.aspx
http://www.codeproject.com/Messages/2857480/Multiline-listview.aspx
http://www.codeproject.com/Messages/2857480/Multiline-listview.aspx


