Getting Started with Windows Forms FontComboBox
7 Mar 20233 minutes to read
This section briefly describes how to create a new Windows Forms project in Visual Studio and add the FontComboBox control with its functionalities.
Refer Control dependencies section to get the list of assemblies or NuGet package needs to be added as reference to use the FontComboBox in any application.
You can find more details about installing the NuGet packages in a Windows Forms application in the following link:
Creating Application with FontComboBox
In this walk through, users will create WinForms Application that contains
Creating the Project
Create new Windows Forms Project in Visual Studio to display FontComboBox with font items.
Adding FontCombobox Control via Designer
The FontComboBox control can be added to the application by dragging it from Toolbox and dropping it in designer. The required assembly reference will br added automatically.
Adding FontComboBox control via code
In order to add FontComboBox control manually, do the below steps,
Add the required assembly references to the project.
Create the FontComboBox control instance and add it to the form.
FontComboBox fontComboBox = new FontComboBox(); fontComboBox.Size = new Size(150, 40); fontComboBox.Location = new Point(100, 100); this.Controls.Add(fontComboBox);
Dim fontComboBox As New FontComboBox() fontComboBox.Size = New Size(150, 40) fontComboBox.Location = New Point(100, 100) Me.Controls.Add(fontComboBox)
The default font items in the FontComboBox control can be loaded by using the UseAutoComplete property.
fontComboBox.UseAutoComplete = true;
fontComboBox.UseAutoComplete = True
You can programmatically select the item or index by using the SelectedItem or SelectedIndex properties in FontComboBox control.
//Select the item using SelectedItem property. fontComboBox.SelectedItem = "Arial"; //Select the index using SelectedIndex property. fontComboBox.SelectedIndex = 1;
'Select the item using SelectedItem property. fontComboBox.SelectedItem = "Arial" 'Select the index using SelectedIndex property. fontComboBox.SelectedIndex = 1
RTL is used to display the content from right to left by setting the RightToLeft property to
fontComboBox.RightToLeft = RightToLeft.Yes;
fontComboBox.RightToLeft = RightToLeft.Yes