I cannot make my application DPI-aware. In app.manifest I uncommented:
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
</windowsSettings>
</application>
In App.config I added:
<appSettings>
<add key="EnableWindowsFormsHighDpiAutoResizing" value="true" />
</appSettings>
I am following the questions and responses in Make vb.net application DPI aware and https://www.telerik.com/blogs/winforms-scaling-at-large-dpi-settings-is-it-even-possible-
My application has a single form with a single user control. On each I tried running the app with the AutoScaleMode to each of the various settings: None, Dpi, Font, Inherit (they default to Font). I am using a single monitor which is factory original on my laptop.
In every case, e.graphics.dpix and e.graphics.dpiy (where e is PaintEventArgs) is 96.0. It should be 128.0 = 1920 pixels / 15 inches and 128.0 = 1080 / 8.4375 inches.
What am I missing?
Here's a partial solution.
For painting to the screen, set Graphics.PageUnit = GraphicsUnit.Point (the default is GraphicsUnit.Display).
(I haven't figured out how to AutoSize the UserControl that I'm painting without kludging DPI.)
For printing, use Graphics.PageUnit = GraphicsUnit.Pixel.