dotnet / winforms

Windows Forms is a .NET UI framework for building Windows desktop applications.
MIT License
4.37k stars 966 forks source link

[HDPI]A form with FormBorderStyle=FixedDialog and ControlBox=false is sized incorrectly #5113

Open Marie-Shi opened 3 years ago

Marie-Shi commented 3 years ago

More info: There is a similar VSO bug: 631474.

Actual behavior: The form is truncated at the bottom. Capture

Expected behavior: Form should look the same way as in the designer.

Minimal repro:

  1. Create a Winforms core application in 100% DPI mode.
  2. In the Form’s properties, set the FormBorderStyle = FixedDialog and ControlBox = false.
  3. Adding some controls(such as Button) near the bottom of the form.
  4. Declare compatibility with Window 10 in app.manifest: win10
  5. Set Windows DPI as 300%, build and run the application, then observe the form size.

Or

  1. Set Windows DPI as 300%.
  2. Open the attached application. WinFormsApp4.zip
  3. Build and run it, then observe the form size.
kuhnboy commented 2 years ago

I'm interested in the fix as well. Changing ControlBox from false to true fixes the issue, but I don't want a control box.