【发布时间】:2018-09-01 08:34:00
【问题描述】:
我的 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设置为True- 没有帮助
我怎样才能真正做到这一点?
编辑:列设置:
编辑#2:
【问题讨论】:
标签: c# .net winforms datagridview