Creating and displaying forms in VS 2022 Community 17.12.3

Amyco 35 40 Reputation points
2024-12-12T16:35:14.8133333+00:00

Hello

I reopen under VS 2022 Community 17.12.3 an old WinForm application developed by me under VS 2010, which targets .Net Framework 4.0.

Under VS 2022 it now targets .Net Framework 4.8.1.

The compilation is Ok and I start the execution (in Debug and Release). The application launches and works correctly but the various forms that compose it are smaller than in the VS 2022 view designer. The texts and the various components also have different sizes and positions.

Do you have any idea of ​​the origin of this behavior and how to fix it?

Thank you for your help

Best regards

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,915 questions
Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,316 questions
0 comments No comments
{count} votes

Accepted answer
  1. Jiale Xue - MSFT 48,441 Reputation points Microsoft Vendor
    2024-12-13T08:01:28.33+00:00

    Hi @Amyco 35 , Welcome to Microsoft Q&A,

    This is not a regular way to upgrade a project, so it may cause various unexpected events, and some may even fail to open the original project.

    You can refer to Visual Studio 2022 Port, migrate, and upgrade projects to migrate the project.

    Sometimes, a newer version of Visual Studio can open a project, but it must update or migrate the project in a way that might render it incompatible with previous versions. Visual Studio uses the following criteria to determine whether such migration is necessary:

    Of course, your problem seems to be because in Visual Studio 2022 and .NET Framework 4.8.1, by default, the application enables DPI awareness, causing controls to scale proportionally on high-resolution screens.

    If you need to disable DPI awareness behavior, you can ensure that the following settings exist or modify them in the app.manifest file of the application:

    <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">false</dpiAware>
    

    However, in general, the conversion from the old version to the new version will not be 100% successful. You can fix this problem manually.

    Best Regards,

    Jiale


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". 

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


1 additional answer

Sort by: Most helpful
  1. Amyco 35 40 Reputation points
    2024-12-13T17:13:15.6+00:00

    Hello Jiale Xue,

    Thanks for your quick and detailed reply. I will follow your recommendation. My project is written in VB.Net and I don't see an app.manifest file. Maybe it is possible to put the instruction in the .sln file of the solution? At the very beginning?

    Thanks

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.