如何使用vb.net窗体表单在datagridview列中包装文本 [英] How to wrap text in datagridview column using vb.net windows forms

查看:57
本文介绍了如何使用vb.net窗体表单在datagridview列中包装文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望找到一个简单的解决方案来在datagridview列中包装文本。我的文字太长了,我不得不水平滚动阅读所有内容。我希望通过包装文本来解决这个问题。这是我尝试过的,但它对我没用。



Hi, I'm hoping find a simple solution to wrap text in a datagridview column. My text is too long and I have to scrol horizontally to read all of it. I'm hoping that by wrapping the text it will solve this issue. This is what I've tried but it hasn't worked for me.

Public Property WrapMode As DataGridViewTriState
DataGridView1.Columns(0).DefaultCellStyle.WrapMode = DataGridViewTriState.True

推荐答案

我不确定为什么这似乎不适合你。

您是否设置了AutoSizeRowsMo​​de属性?



I'm not sure why that did not appear to work for you.
Have you set the AutoSizeRowsMode property?

DataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells


试试这个

Try this
DataGridView1.Columns(0).Styles.Add("word-wrap","break-word");


同时设置



Also set the

dataGridView.RowsDefaultCellStyle.WrapMode = DataGridViewTriState.True


这篇关于如何使用vb.net窗体表单在datagridview列中包装文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆