如果 DataGridViewTextBoxColumn 的文本太长,如何使其换行?
我的问题很简单,但我想不出一个简单的解决方案。假设我有一个 DataGridViewTextBoxColumn
。如果文本太长而无法在一行中显示,如何将其分成多行?
My question is simple, but I can not think of an easy solution. Lets say I have a DataGridViewTextBoxColumn
. How can I make it break text into several lines if it is too long to be shown in one line?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要创建一个新的
DataGridViewCellStyle
类 与WrapMode
属性 设置为“True”,并将其分配给DataGridViewTextBoxColumn
的DefaultCellStyle
属性。例如:
You need to create a new
DataGridViewCellStyle
class with theWrapMode
property set to "True", and assign this to theDefaultCellStyle
property of yourDataGridViewTextBoxColumn
.For example:
将
DataGridViewTextBoxColumn
的DefaultCellStyle
的WrapMode
设置为true
。Set the
WrapMode
of theDefaultCellStyle
of yourDataGridViewTextBoxColumn
totrue
.