WindowsFormsSettings.TouchScaleFactor Property
Gets or sets a scale factor used to calculate the size of controls and distance between their elements in touch UI mode. This is a static (Shared in VB.NET) property.
Namespace: DevExpress.XtraEditors
Assembly: DevExpress.Utils.v24.2.dll
Declaration
Property Value
Type | Default | Description |
---|---|---|
Single | 2 | A scale factor used to calculate the size of controls and distance between their elements in touch UI mode. |
Remarks
In touch UI mode, controls automatically increase their size and the distance between some of their elements. The following images show a Ribbon Control painted when touch UI mode is disabled and enabled, respectively.
Project Settings
Use the DevExpress Project Settings window to enable touch mode and specify the scale factor. Right-click the project in the Solution Explorer window, then click DevExpress Project Settings.
In the Application UI section, specify UI mode and the scale factor.
Settings specified in the DevExpress Project Settings window are applied at design time and runtime.
Application Configuration File
You can also modify the project’s App.config file as shown below to enable touch mode and specify the scale factor. Note that you should reopen the project to apply the changes.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral">
<section name="DevExpress.LookAndFeel.Design.AppSettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral" requirePermission="false"/>
</sectionGroup>
</configSections>
<applicationSettings>
<DevExpress.LookAndFeel.Design.AppSettings>
<setting name="TouchUI" serializeAs="String">
<value>True</value>
</setting>
<setting name="TouchScaleFactor" serializeAs="String">
<value>1.5</value>
</setting>
</DevExpress.LookAndFeel.Design.AppSettings>
</applicationSettings>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
</startup>
</configuration>
Settings in the application configuration file are only applied at design time. To apply these settings at runtime, call the LoadApplicationSettings() method before the main application form is initialized, or specify settings in code.
Note
We recommend that you use the DevExpress Project Settings window to specify UI mode and the scale factor.
Specify UI Mode in Code
You can also use the TouchUIMode and TouchScaleFactor
properties to enable touch mode and the scale factor in code. Specify these settings before the main application form is initialized.
using DevExpress;
static class Program {
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main() {
WindowsFormsSettings.TouchUIMode = LookAndFeel.TouchUIMode.True;
WindowsFormsSettings.TouchScaleFactor = 2;
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
Note
If you specify UI mode and the scale factor in code, these settings are only applied at runtime. To apply touch UI mode at design time, use DevExpress Project Settings.
Specify UI Mode in Code for a Specific Form
Use a form’s TouchUIMode and TouchScaleFactor options to specify the form’s UI mode and scale factor. To access these options, use the form’s LookAndFeel property. These options are in effect for XtraForm and TabForm objects and their descendants, except for RibbonForm objects. A form’s options override the global TouchUIMode and TouchScaleFactor
options.