Back to Devexpress

Font Dialog

windowsforms-9576-controls-and-libraries-rich-text-editor-visual-elements-dialogs-font-dialog.md

latest6.1 KB
Original Source

Font Dialog

  • Aug 26, 2024
  • 2 minutes to read

Overview

The Font dialog allows users to specify font settings: character size, style, and color.

Click the Font group’s dialog box launcher on the Home ribbon tab to invoke the Font dialog.

Refer to the following topic for information on how to provide the Ribbon UI for the RichEditControl: How to: Create the RichEditControl with a Ribbon UI .

You can also press Ctrl + D or use the context menu item to invoke this dialog.

The dialog ships with the following tabs:

Font

Options on this tab allow users to change the font name, size and style, enable underline and font effects.

The following API allows you to specify the Font options in code:

Tip

Use the SubDocument.BeginUpdateCharacters and SubDocument.EndUpdateCharacters pair of methods to access the CharacterProperties members and modify character properties in code.

APIDescription
CharacterPropertiesBase.FontNameGets or sets the font name.
CharacterPropertiesBase.FontSizeSpecifies the font size.
CharacterPropertiesBase.Italic
CharacterPropertiesBase.BoldSpecify the font style.
CharacterPropertiesBase.ForeColorGets or sets the font color
CharacterPropertiesBase.UnderlineSpecifies the underline type.
CharacterPropertiesBase.UnderlineColorSpecifies the underline color.
CharacterPropertiesBase.StrikeoutGets or sets the strikeout type.
CharacterPropertiesBase.SubscriptGets or sets whether characters are subscript.
CharacterPropertiesBase.SuperscriptGets or sets whether characters are superscript.
CharacterPropertiesBase.SmallCapsGets or sets whether all characters are small capital letters.
CharacterPropertiesBase.AllCapsGets or sets whether characters are capital letters.
CharacterPropertiesBase.HiddenSpecifies whether characters are hidden.

Refer to the following topic for an example on how to change character properties in code: How to: Change Formatting of Selected Text.

Advanced

Options on this tab allow users to change character spacing options: scale percentage, spacing between characters, position and kerning.

The table below lists API you can use to specify Advanced options:

APIDescription
CharacterPropertiesBase.ScaleGets or sets the characters’ scaling percentage.
CharacterPropertiesBase.SpacingSpecifies the spacing between characters.
CharacterPropertiesBase.PositionGets or sets the characters’ position relative to the base line.
CharacterPropertiesBase.KerningThresholdSpecifies the minimum font size for which the kerning is adjusted automatically.
CharacterPropertiesBase.SnapToGridGets or sets whether to snap characters to a grid when the grid is defined.

Refer to the following topic for an example on how to change character properties in code: How to: Change Formatting of Selected Text.

Invoke the Dialog in Code

Execute the ShowFontFormCommand command to invoke the Font dialog.

Handle the RichEditControl.FontFormShowing event to customize the Font dialog (modify captions, set default dialog values, implement custom validation, etc.) or substitute it with completely new dialog.