FontDialog.MinSize Property


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Gets or sets the minimum point size a user can select.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public int MinSize { get; set; }

Property Value

Type: System.Int32

The minimum point size a user can select. The default is 0.

In order for the maximum and minimum size settings to take effect, MaxSize must be greater than MinSize, and both must be greater than 0.

Attempts to set this property to values less than 0 will result in a value of 0 being used. If you set MinSize to a value greater than MaxSize, MaxSize is set to the value of MinSize. The effect of setting MinSize and MaxSize to the same value is to limit the size selection to a single font size.

When the point size is 0, there are no font size limits.

The following code example demonstrates using the MinSize, MaxSize, ShowEffects and FontMustExist members and handling the Apply event. To run this example paste the following code in a form containing a FontDialog named FontDialog1 and a Button named Button1.

private void Button1_Click(System.Object sender, System.EventArgs e)
	// Set FontMustExist to true, which causes message box error
	// if the user enters a font that does not exist. 
	FontDialog1.FontMustExist = true;

	// Associate the method handling the Apply event with the event.
	FontDialog1.Apply += new System.EventHandler(FontDialog1_Apply);

	// Set a minimum and maximum size to be
	// shown in the FontDialog.
	FontDialog1.MaxSize = 32;
	FontDialog1.MinSize = 18;

	// Show the Apply button in the dialog.
	FontDialog1.ShowApply = true;

	// Do not show effects such as Underline
	// and Bold.
	FontDialog1.ShowEffects = false;

	// Save the existing font.
	System.Drawing.Font oldFont = this.Font;

	//Show the dialog, and get the result
	DialogResult result = FontDialog1.ShowDialog();

	// If the OK button in the Font dialog box is clicked, 
	// set all the controls' fonts to the chosen font by calling
	// the FontDialog1_Apply method.
	if (result == DialogResult.OK)
		FontDialog1_Apply(this.Button1, new System.EventArgs());
		// If Cancel is clicked, set the font back to
		// the original font.
	else if (result == DialogResult.Cancel)
		this.Font = oldFont;
		foreach ( Control containedControl in this.Controls)
			containedControl.Font = oldFont;

// Handle the Apply event by setting all controls' fonts to 
// the chosen font. 
private void FontDialog1_Apply(object sender, System.EventArgs e)

	this.Font = FontDialog1.Font;
	foreach ( Control containedControl in this.Controls )
		containedControl.Font = FontDialog1.Font;

.NET Framework
Available since 1.1
Return to top