AppearanceObject.Font Property
Gets or sets the font used to paint the text.
Namespace: DevExpress.Utils
Assembly: DevExpress.Utils.v24.2.dll
NuGet Packages: DevExpress.Utils, DevExpress.Wpf.Core
#Declaration
#Property Value
Type | Description |
---|---|
Font | A Font object specifying the font used to display the contents of elements. |
#Remarks
The following example specifies custom fonts and font settings of a simple button and grid columns:
using System.Drawing;
namespace DXApplication {
public partial class Form1 : DevExpress.XtraEditors.XtraForm {
public Form1() {
InitializeComponent();
simpleButton1.Appearance.Font = new Font("Arial", 12, FontStyle.Bold);
gridColumn1.AppearanceHeader.Font = new Font("Courier New", 14, FontStyle.Bold);
gridColumn1.AppearanceCell.Font = new Font("Courier New", 10, FontStyle.Bold);
gridColumn2.AppearanceHeader.Font = new Font("Times New Roman", 14, FontStyle.Underline);
gridColumn2.AppearanceCell.Font = new Font("Times New Roman", 10, FontStyle.Underline);
gridView1.OptionsView.ColumnHeaderAutoHeight = DevExpress.Utils.DefaultBoolean.True;
}
}
}
#Default Application Font
DevExpress WinForms controls use the “Tahoma” font as the default font. Use the following properties to change the default font used by DevExpress controls in your application:
- WindowsFormsSettings.DefaultFont - Gets or sets the default font for DevExpress controls (except menus and toolbars). This is a static property.
- WindowsFormsSettings.DefaultMenuFont - Gets and sets the default font used to display text on menus, toolbars and popup menus (except Ribbon elements). This is a static property.
- WindowsFormsSettings.DefaultPrintFont - Gets or sets the default text font for printing. This is a static property.
Read the following topic for additional information: Default Application Font.
#Appearance Settings Inheritance
Setting the Font
property to the control’s default font (which is currently used by the user’s operating system) automatically sets the appearance object’s AppearanceOptions.UseFont property to false. If the UseFont
property is set to false and the current Appearance object has a parent Appearance object, the Appearance object uses the parent’s font settings.
Use the AppearanceObject.GetFont method to obtain the font settings specified by the appearance object’s settings.
Read the following topics for additional information:
#Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the Font property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.