Spread Windows Forms 10.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
|
---|---|
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
|
---|---|
//add code in InitializeComponent() of cs file this.fpSpread1.SpreadScaleMode = FarPoint.Win.Spread.ScaleMode.ZoomDpiSupport; this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; |
Code |
Copy Code
|
---|---|
<?xml version="1.0" encoding="utf-8" ?> <configuration> <appSettings> <add key="EnableWindowsFormsHighDpiAutoResizing" value="true" /> </appSettings> </configuration> |