.NET Framework's FolderBrowserDialog is not DPIAware?

141 Views Asked by At

I've created a simple application with VisualStudio 2022, and .NET Framework 4.8. I have two monitors: A (100%, 96DPI), B (175%, 168DPI).

I did also defined dpiAwareness to PerMonitorV2 in app.manifest.

I added only one control: FolderBrowserDialog:

enter image description here

And I have this code in form's click event handler:

private void Form1_Click(object sender, EventArgs e)
{
    folderBrowserDialog1.ShowDialog();
}

Folder browser looks great at first:

enter image description here

However, if I move it between the two monitors, it gets corrupted:

enter image description here

How can I make this system form also DPI-Aware?

1

There are 1 best solutions below

4
Pavan Chandaka On

Setting in application config is one thing.

But there are other things to be taken care.

  • Declare compatibility with operating system.
  • Also enabling visual styles. Application.EnableVisualStyles() should be called first in the entry point (your main function).

The below link has description about the above said settings. In the below link look for Configuring your Windows Forms app for high DPI support

https://learn.microsoft.com/en-us/dotnet/desktop/winforms/high-dpi-support-in-windows-forms?view=netframeworkdesktop-4.8