Skip to content

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

Closed

Description

@199621616

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

Activity

  1. RussKie commented on Dec 15, 2019

    @RussKie
    Contributor

    @199621616 please write in English if you require assistance.

    @Olina-Zhang is this something you can read?

  2. maikebing commented on Dec 15, 2019

    @maikebing
    Contributor

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

  3. 199621616 commented on Dec 15, 2019

    @199621616
    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.

  4. 199621616 commented on Dec 15, 2019

    @199621616
    Author

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

  5. Vino-Wang commented on Dec 16, 2019

    @Vino-Wang

    @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,

  6. RussKie commented on Dec 16, 2019

    @RussKie
    Contributor

    @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:

  7. 199621616 commented on Dec 16, 2019

    @199621616
    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.

  8. added
    📚 documentation
    on Dec 16, 2019
  9. ghost locked as resolved and limited conversation to collaborators on Feb 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    📚 documentation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions