How to let "DataGridViewTextBoxColumn
" in DataGridView
supports Multiline property?
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Generic Generics in Managed C++
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
I have found that there are two things that you need to do, both in the designer, to make a text cell show multiple lines. As Tim S. Van Haren mentioned, you need to set
WrapMode
of theDefaultCellStyle
of yourDataGridViewTextBoxColumn
totrue
. And although that does make the text wrap, it doesn't make the row expand to show anything beyond the first line. In addition toWrapMode
, theAutoSizeRowsMode
of theDataGridView
must be set to the appropriateDataGridViewAutoSizeRowsMode
enumeration value. A value such asDataGridViewAutoSizeRowsMode.AllCells
allows the cell to expand vertically and show the entire wrapped text.You should be able to achieve this by setting the
WrapMode
of theDefaultCellStyle
of yourDataGridViewTextBoxColumn
totrue
.Apart from setting
WrapMode
of theDefaultCellStyle
, you can do the following:EditingControlShowing
EventControl
property on the EventArgs to the type you want (i.e. textbox, checkbox, or button)Multiline
property like below: