Category / Section
How to apply font settings in the WinForms MultiColumnComboBox DropDown?
1 min read
Apply font settings
In the MultiColumnComboBox, GridListControl is used as the DropDown control, and its row size is not be applied based on the font settings. GridListControl row and column sizes can be updated based on its font size, by using the ResizeToFit function.
The following code example demonstrates the same.
C#
//Resizes the column width on specifying the font. this.mGrid_02.ColWidths.ResizeToFit(GridRangeInfo.Table()); //Resizes the row height on specifying the font. this.mGrid_02.RowHeights.ResizeToFit(GridRangeInfo.Table());
VB
'Resizes the column width on specifying the font. Me.mGrid_02.ColWidths.ResizeToFit(GridRangeInfo.Table()) 'Resizes the row height on specifying the font. Me.mGrid_02.RowHeights.ResizeToFit(GridRangeInfo.Table())
Note:
The Grid is displayed without hiding or wrapping text by using the ResizeToFit function in the GridControl.
Figure 1: Before selecting font in MultiColumnComboBox
Figure 2: After selecting font in MultiColumnComboBox without resizing rows and columns
Figure 3: Font specified in MultiColumnComboBox with resizing rows and columns
Samples: