Open alejo9010 opened 2 years ago
Hello @alejo9010 the first thing that comes to my mind is that a DPI setting might throw it off the actual coordinates. Can you tell me a bit more of your system/screen settings, like what OS are you using, do you have DPI scaling activated (which value is it set to), what are the given values and what is the actual result? I wish you a nice day 😄 , Gregor
I'm seeing this issue too. On a Win 10 VM (Virtualbox) no DPI Scaling I'm trying to click on a control that's pretty much in the middle of the screen but it's clicking on VS's System menu which is top left my actual mouse pointer was somewhere completely different and didn't move throughout execution.
Hello @BigIan1969 , can you tell me a bit more about the execution/setup? In general I would like to know how the setup looks like and how you interact with it, so that I get a better picture of the issue.
Add-Type -AssemblyName System.Windows.Forms
and
Add-Type @'
using System;
using System.Runtime.InteropServices;
using System.Drawing;
public class DPI {
[DllImport("gdi32.dll")]
static extern int GetDeviceCaps(IntPtr hdc, int nIndex);
public enum DeviceCap { VERTRES = 10, DESKTOPVERTRES = 117 }
public static float scaling() { Graphics g = Graphics.FromHwnd(IntPtr.Zero); IntPtr desktop = g.GetHdc(); int LogicalScreenHeight = GetDeviceCaps(desktop, (int)DeviceCap.VERTRES); int PhysicalScreenHeight = GetDeviceCaps(desktop, (int)DeviceCap.DESKTOPVERTRES);
return (float)PhysicalScreenHeight / (float)LogicalScreenHeight; } } '@ -ReferencedAssemblies 'System.Drawing.dll' -ErrorAction Stop Return [DPI]::scaling() * 100
hello, im triying to make this work to move mouse to relative window coord, so i got this
but the mouse is off by alot from the actual Point where it should move, i debug the app, and the coords are correct. any idea what happen ?