In Winforms, is there a way to have a single DataGridView r开发者_Go百科ow span multiple lines? So that the cells of a single row can be stacked onto two lines.
Something like this:
The only "simple" way to do this is with custom painting. It still isn't entirely trivial however, and you do not get editable cells this way.
Any solution to give editable cells would require a lot of custom code.
Quoting the DataGridView Program Manager Mark Rideout from a forum discussion:
The DataGridView does not have any support for merging cells. You can custom paint content across cells, but apart from that you would have to do a lot of work and custom coding to produce merged editable cells.
That forum does contain some example code of custom painting if that will do for your requirement.
精彩评论