I created a simple single window WinForms app in VS2017 with a completely empty form. I added a manifest file to the application and uncommented the section on DPI awareness to make the application DPI aware. Now when I run the application and resize the window by dragging the right or bottom there are black lines drawn in the window. They go away when the window is minimized and maximized again.
If you look closely at the image you can see that the content area of the window (grey) covers up the border (blue) on the left and bottom edges. Seems related.
Here is the manifest:
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
</windowsSettings>
</application>
</assembly>
Other than the manifest change, the rest of the application is what was generated by new WinForms application in VS2017 with no additions. The project targets .NET framework 4.6. I'm running on Windows 10 with scaling at 100%.
The reason I need the application to be dpi aware is to solve the issue with the CommonFileDialog described here: CommonOpenFileDialog cause Windows Form to shrink