将文本包装到DataGridView单元格中的新行

发布于 2025-02-07 20:54:34 字数 1145 浏览 3 评论 0原文

下午好!

DataGridView列具有以下文本:

(dep)
程序员(it InfrastComcture)
程序员(INFRASTCOCTURE)
系统管理员(INFRASTCOCTURE)
程序员(INFRASTCOCTURE)工程师(INFRRASTCOCTURE)
工程师(INFRRASTCOCTURE)
系统管理员(INFRASTCOCTURE)

title DataGridView设置为:

DataGridView1.RowTemplate.Height = 44

告诉我,如何将包含在括号中的测试移动到单元格中的新行?

DataGridView列中的所有单元格应该看起来像这样:

programmer 
IT infrastcomcture

您当然可以这样做:

DataGridView1.Columns(2).DefaultCellStyle.WrapMode = DataGridViewTriState.True
DataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells

但是此代码无法正常工作。我希望,无论列的宽度如何,括号中指示的文本都会转移到单元格中的新线路

Good afternoon!

The DataGridView column has the following text:

Title (Dep)
programmer (IT infrastcomcture)
programmer (IT infrastcomcture)
System Administrator(IT infrastcomcture)
programmer (IT infrastcomcture)
engineer(IT infrastcomcture)
System Administrator(IT infrastcomcture)

The height of the rows in the DataGridView is set to:

DataGridView1.RowTemplate.Height = 44

Tell me, how can I move the test, which is contained in brackets, to a new line in the cell?

All cells in the Datagridview column should look like this:

programmer 
IT infrastcomcture

You can of course do this:

DataGridView1.Columns(2).DefaultCellStyle.WrapMode = DataGridViewTriState.True
DataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells

But this code won't work. I want that, regardless of the width of the column, the text that is indicated in brackets will be transferred to a new line in the cell

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文