Forum > Coding >

[TUT?] Windows Forms DPI Awareness

Posts: 0

Threads: 0

Joined: ?

Reputation:

Posted

Not sure if this counts as a tutorial but i noticed that beginner Winforms executors all have this problem. Where when you build it and the graphics are blurry or not as clear compared to when designing. This also fixes that bug where after building, your winform will shrink in size, cutting out some parts.

So please. If you're using Winforms, please, use this. Unless you like crap graphic quality. 

 

You need to add a manifest file for this to work. Right click solution + Add item. Can't find it? Go to Project Properties and under Icon and Manifest, change the manifest selection to "Create application without manifest". Now you can add it.

 

Go to the manifest file and add the following code in between the <assembly> brackets:

<compatibility xmlns="urn:schemas-microsoft.com:compatibility.v1"> <application> <!-- Windows 10 compatibility --> <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" /> </application> </compatibility>

Next, go to your app.config and in between <configuration> and </configuration> add this:

<System.Windows.Forms.ApplicationConfigurationSection> <add key="DpiAwareness" value="PerMonitorV2" /> </System.Windows.Forms.ApplicationConfigurationSection>

Source

Go to the source for the code. The thread reformatted it so it might not work.

 

Remember to bring the app.config and manifest file to wherever the application is if you're moving it or uploading it to a site. Removing the app.config and manifest from the same directory as your winforms will make your winforms disgusting again.

  • 0

Wabz

Winning.js

Posts: 1956

Threads: 143

Joined: Apr, 2020

Reputation: 27

Replied

Yeah i had issuess like this before, the fix is to set DPI stuff.

  • 0

My new discord is Wabz#1337 with ID 777154062789509130

Users viewing this thread:

( Members: 0, Guests: 1, Total: 1 )