Apparently, the only way to have multiline cells in a DataGridView is by setting the WrapMode of its DefaultCellStyle to true. My problem is that I also want the width of the column to adjust automatically to the content of the cell, instead of wrapping it by adding line breaks.
Even if I set AutoSizeColumnsMode to AllCells, it will wrap the text instead of making the header bigger. I would also like the row height to adjust automatically. So I don’t really want to wrap anything at all. Just adjust width and height to the size of the text.
Just set the
ColumnHeadersHeightSizeModeproperty toDataGridViewColumnHeadersHeightSizeMode.DisableResizing. Here‘s more info;