title: WinForms 4K and 1080p scaling / high DPI?
body: <p>So, here is the scenario: I am trying to make all of my forms (which are Winforms) look good in 4K and 1080p also known as high-DPI or "dpi-aware". I (for the purpose of this question) have three forms: <em>frmCompanyMasterEdit</em> which inherits from <em>frmBaseEdit</em> which inherits from <em>frmBase</em>, which inherits form <em>System.Windows.Forms.Form</em>. </p>
  
  <p>I have tried the old way, by making my application DPI-aware in the manifest:</p>
  
  <pre><code>  &lt;application xmlns="urn:schemas-microsoft-com:asm.v3"&gt;
      &lt;windowsSettings&gt;
        &lt;dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings"&gt;true&lt;/dpiAware&gt;
      &lt;/windowsSettings&gt;
    &lt;/application&gt;
  </code></pre>
  
  <p>That way, other than minor anchoring issues which I can fix, the form looks perfect at 4K and looks just like that but a bit blurrier in 1080p. Here it is in 4K: <a href="https://i.stack.imgur.com/93SPo.png" rel="noreferrer">4K both old and new ways</a>. </p>
  
  <p>Anyway, so I scratch that and try it the new way described in .NET 4.7, targeting the 4.7 framework and adding the following code: </p>
  
  <p>to app.config</p>
  
  <pre><code>&lt;System.Windows.Forms.ApplicationConfigurationSection&gt;
     &lt;add key="DpiAwareness" value="PerMonitorV2" /&gt;
  &lt;/System.Windows.Forms.ApplicationConfigurationSection&gt;
  </code></pre>
  
  <p>to app.manifest</p>
  
  <pre><code>&lt;!-- Windows 10 compatibility --&gt;
  &lt;supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" /&gt;
  </code></pre>
  
  <p>and also taking the old code out of the app.manifest so as to not override the new .NET 4.7 way. I made sure to put the code in the appropriate places.
  So here the form looks good in 4K as the image above but now in 1080p it is very zoomed in as shown here:
  <a href="https://i.stack.imgur.com/3D7Tp.png" rel="noreferrer">1080p new way</a></p>
  
  <p>So either way, the form looks great in 4k other than minor anchoring issues, and it either (the old way) is the right size but a bit blurry in 1080p or is not blurry in 1080p but is really zoomed in. 
  I also had to change these two lines in all the designer.vb files as shown below:</p>
  
  <pre><code>Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!)
  Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi
  </code></pre>
  
  <p>I don't know why I just can't get it looking appropriate in 1080p. Like I said, I am targeting the 4.7 .NET framework. I am running on the appropriate version of Windows 10 (Version 1709 / Creator's edition). The 1080p is scaled at 100%. Also, we do not have the resources to upgrade to WPF.</p>