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

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -