Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

迁移到.NetCore3.1后窗口变形严重 #2503

Closed
199621616 opened this issue Dec 14, 2019 · 7 comments
Closed

迁移到.NetCore3.1后窗口变形严重 #2503

199621616 opened this issue Dec 14, 2019 · 7 comments
Labels
📚 documentation Documentation bug or improvement

Comments

@199621616
Copy link

199621616 commented Dec 14, 2019

将基于.Net Framework 4.6.1的WinForm迁移到.Net Core 3.1后窗口变形严重。是我错过了什么,还是.Net Core 3.1本是如此?需要我们根据.Net Core 3.1再调整,还是需要你们修复?
下图左右两个窗口差距很大,代码没有任何变动。
image

@RussKie
Copy link
Member

RussKie commented Dec 15, 2019

@199621616 please write in English if you require assistance.

@Olina-Zhang is this something you can read?

@maikebing
Copy link
Contributor

@199621616 add Application.SetHighDpiMode(HighDpiMode.SystemAware); to
static void Main(string[] args)

@199621616
Copy link
Author

After migrating WinForm based on. Net framework 4.6.1 to. Net core 3.1, the window is seriously deformed. What did I miss, or did. Net core 3.1 originally? Do we need to readjust according to. Net core 3.1, or do you need to fix it?

The left and right windows in the figure below are quite different, and the code has no change.

@199621616
Copy link
Author

add Application.SetHighDpiMode(HighDpiMode.SystemAware); to
static void Main(string[] args)
No change.

@Vino-Wang
Copy link

@199621616 @RussKie, maybe this is caused by issue #1122. And this is a by design issue, the default Font size is changed in Core project,

@RussKie
Copy link
Member

RussKie commented Dec 16, 2019

@199621616, yes this is the most likely reason, depending on values of AutoScaleDimensionsand AutoScaleMode properties of the form.

Please have a look at the docs that detail breaking and other notable changes:

@199621616
Copy link
Author

@thank you very much to vino Wang and @ russkie. After setting the default font to font = new font (New fontfamily ("Microsoft sans serif"), 8F), the problem has been resolved. This issue is closed.

@RussKie RussKie added the 📚 documentation Documentation bug or improvement label Dec 16, 2019
@ghost ghost locked as resolved and limited conversation to collaborators Feb 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
📚 documentation Documentation bug or improvement
Projects
None yet
Development

No branches or pull requests

4 participants