Getting Started with Windows Forms FontComboBox

This section briefly describes how to create a new Windows Forms project in Visual Studio and add the FontComboBox control with its functionalities.

Assembly Deployment

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:

How to install nuget packages

Creating Application with FontComboBox

In this walk through, users will create WinForms Application that contains FontComboBox control.

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.

Drag and drop the control from Toolbox

Adding FontComboBox control via code

In order to add FontComboBox control manually, do the below steps,

1) Add the required assembly references to the project.

2) 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)

Default initialization of WF FontComboBox control

AutoComplete setting

The default font items in the FontComboBox control can be loaded by using the UseAutoComplete property.

fontComboBox.UseAutoComplete = true;
fontComboBox.UseAutoComplete = True

Load the default font items in WF FontComboBox

Selection

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

Select the item using selection property

NOTE

View sample in GitHub

RTL support

RTL is used to display the content from right to left by setting the RightToLeft property to Yes.

fontComboBox.RightToLeft = RightToLeft.Yes;
fontComboBox.RightToLeft = RightToLeft.Yes

Change the control layout position in WF FontComboBox