We are building a Winform app on DotNetcore 6 but the app is not adjusting to different screen resolutions

Sunny Sharma 1 Reputation point
2022-10-26T08:09:33.713+00:00

We are building a Winform app on DotNetcore 6 that need to work on laptops but the app is not adjusting to different screen resolutions even though we have utilized anchor and dock properties of the winform controls. Since the app works fine on resolution 1333*768 with 100% scaling and layout (image attached) 254184-resolution.jpg. I am wondering whether that's possible to start the app in custom resolution all the time by writing c# program irrespective of the host system resolution? Is this something that is achievable

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,425 questions
.NET CLI
.NET CLI
A cross-platform toolchain for developing, building, running, and publishing .NET applications.
324 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,321 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Jiale Xue - MSFT 34,361 Reputation points Microsoft Vendor
    2022-10-27T03:33:56.097+00:00

    Hi @Sunny Sharma , Welcome to Microsoft Q&A.

    There are 3 kinds of applications:

    1. Not DPI aware
    2. System DPI aware
    3. Per monitor DPI aware

    Related Document: https://learn.microsoft.com/en-us/windows/win32/hidpi/high-dpi-desktop-application-development-on-windows?redirectedfrom=MSDN#dpi-awareness-mode

    You can set the DPI-awareness on your application in app.config:

    <appSettings>  
        <add key="EnableWindowsFormsHighDpiAutoResizing" value="false" />  
    </appSettings>  
    

    and app.manifest:

    <application xmlns="urn:schemas-microsoft-com:asm.v3">  
      <windowsSettings>  
        <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">false</dpiAware>  
      </windowsSettings>  
    </application>  
    

    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.