我在WinForm中有DataGridView。我将AutoSizeColumnsMode
设置为Fill
,因为如果用户调整窗口大小,我不需要空格。
我想要实现的目标。例如,用户在特定单元格中键入一些文本。当文本宽度变为单元格宽度时,文本必须是新行的一个。 怎么样:
|Cell Header|
-------------
|text-text |
和
|Cell Header|
-------------
|text-text |
|more text |
|on the new |
|line |
我的列可由用户调整大小。所以这:
|Cell Header|
-------------
|text-text |
|more text |
|on the new |
|line |
可能会这样:
|Cell Header |
---------------------
|text-text more text|
|on the new line |
我从其他SO答案中尝试过:
AutoResizeRowsMode
设为AllCells
- 没有帮助我怎么能实现这个呢?
编辑:列设置:
DefaultCellStyle.WrapMode
编辑#2: