dotnet / dotnet/winforms

Recreate handle resizes the form on monitor with non-96 DPI

Open
#6,125 6 comments 0 reactions 0 assignees View on GitHub
:beetle: bug area-HDPI-SA
Dominant language
C#
Stars
4.9k
Forks
1.1k
Avg merge
1d 13m
Merged PRs (30d)
85

Description

* .NET Core Version: **all**
* Have you experienced this same bug with .NET Framework?: haven't checked

**Problem description:**

On a monitor with non-default DPI (e.g. 150%, 200%, etc.) a form changes its dimensions upon recreation of its handle:

https://user-images.githubusercontent.com/4403806/140443304-0be2fda6-f37e-40b1-b1f8-d4467ba18339.mp4

On a monitor with 100% scale factor everything works as expected.

**Expected behavior:**
The form retains the geometry.

**Minimal repro:**
1. Unzip [repro.zip](https://github.com/dotnet/winforms/files/7479908/repro.zip) in to .\src\System.Windows.Forms\tests\IntegrationTests\WinformsControlsTest
2. Update Program.cs to invoke `Form1`
3. F5

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.