What is the use of AutoSizeMode in the WinForms MultiSelectionComboBox?
AutoSizeMode
The AutoSizeMode helps you to adjust the size of the MultiSelectionComboBox according to your requirement, when its selection mode is set to VisualItem. There are three types of AutoSizeMode.
- None.
- Vertical.
- Horizontal.
None - The AutoSizeModes.None allows you to specify the default size of the MultiSelectionComboBox.
Vertical - The AutoSizeModes.Vertical allows you to adjust the size with respect to height, based on the items of the MultiSelectionComboBox.
Horizontal - The AutoSizeModes.Horizontal allows you to adjust the size with respect to width, based on the items of the MultiSelectionComboBox.
C#
//Sets the AutoSizeMode to None. this.multiSelectionComboBox1.AutoSizeMode = Syncfusion.Windows.Forms.Tools.AutoSizeModes.None; //Sets the AutoSizeMode to Vertical. this.multiSelectionComboBox1.AutoSizeMode = Syncfusion.Windows.Forms.Tools.AutoSizeModes.Vertical; //Sets the AutoSizeMode to Horizontal. this.multiSelectionComboBox1.AutoSizeMode = Syncfusion.Windows.Forms.Tools.AutoSizeModes.Horizontal;
VB
'Sets the AutoSizeMode to None. Me.multiSelectionComboBox1.AutoSizeMode = Syncfusion.Windows.Forms.Tools.AutoSizeModes.None 'Sets the AutoSizeMode to Vertical. Me.multiSelectionComboBox1.AutoSizeMode = Syncfusion.Windows.Forms.Tools.AutoSizeModes.Vertical 'Sets the AutoSizeMode to Horizontal. Me.multiSelectionComboBox1.AutoSizeMode = Syncfusion.Windows.Forms.Tools.AutoSizeModes.Horizontal
The default value of the AutoSizeMode is Vertical and the DisplayMode should be specified as DisplayMode.VisualItem.
Figure 1: MultiSelectionComboBox specified with AutoSizeMode as None
Figure 2: MultiSelectionComboBox specified with AutoSizeMode as Vertical
Figure 3: MultiSelectionComboBox specified with AutoSizeMode as Horizontal
Reference link: https://help.syncfusion.com/windowsforms/classic/multiselectioncombobox/automatic-control-sizing