Dropdown Settings in Windows Forms FontComboBox
27 Apr 20211 minute to read
FontComboBox has properties to control the appearance and behavior of the dropdown.
Properties | Description |
---|---|
DropDownStyle |
Specifies the style of the dropdown. The options are, DropDownList - The user cannot directly edit the text portion. The user must click the arrow button to display the list portion, DropDown (default) - The user can directly edit the text portion. The user must click the arrow button to display the list portion, Simple - The text portion is editable. The list portion is always visible. |
DropDownHeight | Specifies the height of the dropdown combo box in pixels. |
DropDownWidth | Specifies the width of the dropdown combo box in pixels. |
MaxDropDownItems | Indicates the maximum number of entries to display in the drop down list. |
ShowSymbolFontPreview | Specifies the symbols can be rendered with its font name. |
this.fontComboBox2.DropDownHeight = 107;
this.fontComboBox2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.fontComboBox2.DropDownWidth = 154;
this.fontComboBox2.MaxDropDownItems = 10;
this.fontComboBox2.ShowSymbolFontPreview = true;
Me.fontComboBox2.DropDownHeight = 107
Me.fontComboBox2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.fontComboBox2.DropDownWidth = 154
Me.fontComboBox2.MaxDropDownItems = 10
Me.fontComboBox2.ShowSymbolFontPreview = true
Customizing DropDown Items
The height of the FontComboBox items is specified in ItemHeight property and sorting of the items is enabled through Sorted property.
this.fontComboBox2.ItemHeight = 17;
this.fontComboBox2.Sorted = true;
Me.fontComboBox2.ItemHeight = 17
Me.fontComboBox2.Sorted = True