winforms - DataGridViewComboBox dropdown size on multiline -
i have datagridviewcombobox in datagrid. 1 of other columns allows multiple lines of text entered.
my problem dropdown in datagridviewcombobox expands fill cell. dropdown 1 line.
here examples: http://imgur.com/qx4wsuk. in example, first column's dropdowns should 1 line, , not fill whole cell.
you need set cell style's alignment , display style:
var datagrid = new datagridview(); var combobox = new datagridviewcomboboxcolumn(); combobox.defaultcellstyle = new datagridviewcellstyle { alignment = datagridviewcontentalignment.topleft}; combobox.displaystyle = datagridviewcomboboxdisplaystyle.combobox;
msdn on datagridviewcontentalignment
msdn on datagridviewcomboboxdisplaystyle
Comments
Post a Comment