Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Weird RECT behavior in Visual Studio vs LA
#1
Hi !

I'm learning C# and i'm working on Visual Studio and i've imported the LibreAutomate Nuget package to my solution.

My problem is that for some reason this code works in LibreAutomate but not in Visual studio.

My main monitor is 125% dpi-scaled. My second monitor is normal

With LibreAutomate :
Running the code with notepad window on main monitor and second monitor works.

With Visual Studio 2022 :
Running the code on main monitor works but fails on second monitor. RECT top/Left/Bottom/Right coordinates seems wrong

Do you have an idea why ?

Thanks in advance !


Code:
Copy      Help
// script ""
//Setup : Screen 1 is dpi-scaled 125% - Screen 2 is normal
var w = wnd.find(1, "Sans titreĀ - Bloc-notes", "Notepad");
w.Activate();
w.GetRect(out RECT r);

var osd = new Au.osdRect();
osd.Rect = r;
osd.Thickness = 5;

//In both cases, OSD.show is correct
osd.Show();
wait.s(2);

//But this works in LA, but fails in VS (coordinates seems wrong)
mouse.move(r.left, r.top);//Move mouse to top left corner of r RECT.
#2
Need manifest that sets full DPI awareness.

https://www.libreautomate.com/forum/show...6#pid37036
#3
Solved ! Thanks a lot <3


Forum Jump:


Users browsing this thread: 1 Guest(s)