Spread Windows Forms 9.0 Product Documentation > Developer's Guide > Getting Started > Working with the Component > Adding Support for High DPI Settings |
Spread supports high DPI settings provided that the application has high DPI support enabled.
Refer to Microsoft's web site for more information about enabling DPI support for your application.
You can refer to the following steps for a general example of how to enable DPI support in .NET 4.5.2.
Code |
Copy Code
|
---|---|
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" > <asmv3:application> <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings"> <dpiAware>true</dpiAware> </asmv3:windowsSettings> </asmv3:application> </assembly> |
Code |
Copy Code
|
---|---|
static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { SetProcessDPIAware(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainForm()); } [System.Runtime.InteropServices.DllImport("user32.dll")] public extern static IntPtr SetProcessDPIAware(); } |
Note: The SetProcessDPIAware API must be called before any window is created; otherwise, a window created before using this API will have the wrong size and font. |
Code |
Copy Code
|
---|---|
<?xml version="1.0" encoding="utf-8" ?> <configuration> <appSettings> <add key="EnableWindowsFormsHighDpiAutoResizing" value="true" /> </appSettings> </configuration> |