AutoScaleMode = "Font" and increased text size in windows results in clipped texts
- Dominant language
- C#
- Stars
- 4.9k
- Forks
- 1.1k
- Avg merge
- 20h 23m
- Merged PRs (30d)
- 103
Description
### .NET version
.NET 8.0
### Did it work in .NET Framework?
Not tested/verified
### Did it work in any of the earlier releases of .NET Core or .NET 5+?
_No response_
### Issue description
Attached sample is a .NET8 application whose only form is set to `AutoScaleMode = AutoScaleMode.Font`. In the constructor of the form (before doing anything else), I set `this.Font = SystemFonts.MessageBoxFont;`" (which should be the same as `Application.SetDefaultFont(SystemFonts.MessageBoxFont);`).
Then I change the text size in windows. I have only a screenshot of the german version, but I hope you see which setting is meant (an english screenshot is found e.g. in #3583 - but this issue seems to target a different use case):

And I restart the app.
This results in clipped texts for some scalings, for others it seems to work better.
The method `Form.ScaleControl` is invoked if I change the text scale, and my sample prints the result (and the font size) in a textbox.
It seems the horizontal scaling factor is calculated in a way that might cause clipped texts. I would prefer a "larger than necessary scale factor", so that all texts are visible.
### Steps to reproduce
This is the sample: [AutoScaleModeFontTest.zip](https://github.com/user-attachments/files/20127220/AutoScaleModeFontTest.zip)
Change the scaling factor, then start the app.
This is the layout at default **"100%"**:

At **125%**, the label text is clipped, and the textbox content is not completely visible:

From here on, Github scales the screenshots again, so click them to see the original size!
At **150%**, the texts are completely shown, but the gap between the label text and the following textbox is smaller. Same for the textbox content and the right edge:

Same for **175%**:

**200%** results in clipped texts again:

Contributor guide
Assessment
This issue has not been assessed yet.