Try to right-click the project in Solution Explorer, select Add, New Item, and add a new “Application Manifest File (Windows Only)”.
It will contain a commented section that includes a <dpiAware> element. Uncomment it, and add the <dpiAwareness> element. It will look like this:
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness>
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
</windowsSettings>
</application>
See also:
The <longPathAware> element, if exists, can be kept too.
It is probably possible to avoid external functions like GetCursorPos, GetPixel if the pixels are always got from your image.