Category / Section
How to set column width and row height of the grid shown in WinForms MultiColumnComboBox's drop down?
1 min read
Setting column width and row height
Setting column width and row height of the grid shown in WinForms MultiColumn ComboBox drop down can be achieved by handling the DropDown event of the MultiColumnComboBox. In the event handler code, use ColWidths and RowHeights properties of the embedded grid in the MultiColumnComboBox.ListBox.
C#
private void MultiColumnComboBox1_DropDown(object sender, EventArgs e) { GridControl grid = this.MultiColumnComboBox1.ListBox.Grid; for (int i = 1; i <= dt.Rows.Count; i++) { grid.ColWidths[i] = 100; grid.RowHeights[i] = 35; } }
VB
Private Sub MultiColumnComboBox1_DropDown(ByVal sender As Object, ByVal e As EventArgs) Handles MultiColumnComboBox1.DropDown Dim grid As GridControl = Me.MultiColumnComboBox1.ListBox.Grid For i As Integer = 1 To dt.Rows.Count grid.ColWidths(i) = 100 grid.RowHeights(i) = 35 Next i End Sub