DataGridView与列表框列 [英] DataGridView with listbox column
本文介绍了DataGridView与列表框列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想显示
DataGridViewTextBoxColumn
as ListBox
当点击我该怎么办?
无需继承。
解决方案
您可以在 DataGridViewTextBoxColumn
中显示多行文本,并使用设计器或代码使该行自动调整大小:
- 设置
I have some columns with long text of numbers separated by commas I want to show the
DataGridViewTextBoxColumn
asListBox
when it is clicked how can i do it?
Desirably without inheritance.解决方案You can show a multi-line text in
DataGridViewTextBoxColumn
and make the row to be auto-size using designer or code this way:- Set
AutoSizeRowMode
property of yourDataGridView
toAllCells
- Set the
DefaultCellStyle.WrapMode
property of yourDataGridViewTextBoxColumn
toTrue
So it's enough to convert those comma-separated numbers to a
Environment.NewLine
separated text and show them inDataGridView
.这篇关于DataGridView与列表框列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
- Set
查看全文