dotnet / dotnet/winforms

Right aligned elements font scaling problem

Open
#5,076 10 comments 0 reactions 0 assignees View on GitHub
area-Anchor/Scaling 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 up to latest tested 5.0.6

* Have you experienced this same bug with .NET Framework?: No (not applicable).

**Problem description:**

Right aligned elements on the form can change their relative position after font scaling.
For example, when you design a form in designer you often right align labels before input fields:
![image](https://user-images.githubusercontent.com/17767561/121644245-75cc5880-ca9b-11eb-852c-435bd0515f9e.png)

But after you ran this app in .Net, you will see this:
![image](https://user-images.githubusercontent.com/17767561/121644713-099e2480-ca9c-11eb-876b-6ec8e0b99874.png)
Right align is broken due to Font scaling (default font change in net core).

Most interesting things, same app above:
![image](https://user-images.githubusercontent.com/17767561/121645071-74e7f680-ca9c-11eb-90a4-bc8364166e70.png)
![image](https://user-images.githubusercontent.com/17767561/121645261-a82a8580-ca9c-11eb-8f8a-b7ae6931d564.png)
And Right align is ok. ~~I really don't know how this happens :) It seems that's it bugs only with 100% dpi and 100% text size. But this statement must be double checked...~~ Seems it's all depends on the final font size.

Because we are using old designer here it's seems that this is only migration issue. But this is not true, due to new designer is not ready for production use, and we are still force to use old one with .Net :(

**Expected behavior:**

Right align is not broken.

**Minimal repro:**

[RightAlign.zip](https://github.com/dotnet/winforms/files/6636505/RightAlign.zip)

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.