Skip to main content

WindowsFormsSettings.LoadApplicationSettings() Method

Loads application settings and updates the corresponding CLR properties accordingly.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.Utils.v24.1.dll

NuGet Packages: DevExpress.Utils, DevExpress.Wpf.Core

Declaration

public static void LoadApplicationSettings()

Remarks

The LoadApplicationSettings method loads application settings stored in the App.config file and updates the corresponding CLR properties accordingly. Call the LoadApplicationSettings method before the main application form is created.

static class Program {
    /// <summary>
    /// The main entry point for the application.
    /// </summary>
    [STAThread]
    static void Main() {
        WindowsFormsSettings.LoadApplicationSettings();
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);
        Application.Run(new Form1());
    }
}

The given approach applies to standard forms only. Since DevExpress forms load App.config settings automatically, you do not need to call the LoadApplicationSettings method.

In the figure below, you can see how the App.config file can be accessed using Solution Explorer in Visual Studio.

ApplicationSettings_VisualStudio

In the sample configuration file below, the application settings specify the Segoe UI font as a default font for DevExpress controls and the Visual Studio 2013 Blue skin is applied. These settings are automatically applied at design time. Note that you need to re-start Visual Studio to apply these settings.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System" >
      <section name="DevExpress.LookAndFeel.Design.AppSettings" type="System.Configuration.ClientSettingsSection" requirePermission="false" />
    </sectionGroup>
  </configSections>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
    </startup>
  <applicationSettings>
    <DevExpress.LookAndFeel.Design.AppSettings>
      <setting name="DefaultAppSkin" serializeAs="String">
        <value>Skin/Visual Studio 2013 Blue</value>
      </setting>
      <setting name="DefaultAppFont" serializeAs="String">
        <value>Segoe UI;11</value>
      </setting>
    </DevExpress.LookAndFeel.Design.AppSettings>
  </applicationSettings>
</configuration>

The table below lists the settings exposed by the AppSettings class that you can declare in your configuration file. You can launch the DevExpress Project Settings dialog to modify these settings.

Setting name Description Affected property Available values or Example
DefaultAppSkin Specifies the style (and if the skin style is applied, the skin name) used to render DevExpress controls. For instance, to draw controls using flat borders, set this setting to Flat. To draw controls using a particular skin, this setting should contain the skin name after a slash symbol, e.g., to display controls using the Visual Studio 2013 Blue skin, set this setting to Skin/Visual Studio 2013 Blue. UserLookAndFeel.Style and UserLookAndFeel.SkinName Skin/Visual Studio 2013 Blue
DefaultAppFont Specifies the default font for DevExpress controls that support the appearance mechanism. The font should be specified using the font family name and font size separated with a semicolon. For instance, to use the Segoe UI font, 11 points, set this setting to Segoe UI;11. If the font size is not specified, the default font size is used. WindowsFormsSettings.DefaultFont Segoe UI;11
FontBehavior Specifies the font used by DevExpress controls, and depending on the specified value, can force standard .NET controls to use the same font. See the WindowsFormsSettings.FontBehavior property to learn about the provided behaviors. If the DefaultAppFont setting is specified, the FontBehavior setting is not in effect. WindowsFormsSettings.FontBehavior Default, UseControlFont, UseTahoma, UseWindowsFont, ForceWindowsFont, ForceTahoma
TouchUI Specifies whether touch UI mode is enabled, in which controls automatically increase their size and the distance between some of their elements. WindowsFormsSettings.TouchUIMode True, False
TouchScaleFactor Specifies the scale factor used to calculate the size and distance between specific control elements when touch UI mode is enabled. WindowsFormsSettings.TouchScaleFactor 1.5
RegisterUserSkins Specifies whether to register custom user skins for design time use. Set this setting to True to enable using custom user skins at design time. True, False

The following code snippets (auto-collected from DevExpress Examples) contain references to the LoadApplicationSettings() method.

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.

See Also