DevFear
Topic Author
Posts: 52
Joined: 29 Jun 2022, 12:36

The Canvas.SetLeft() and Canvas.SetTop() methods do not work correctly when scaling the Windows 125% screen

12 Oct 2022, 17:42

When creating an element, I take the mouse position and use it as the spawn point of the element. And if everything works correctly at 100% scaling, then it does not work correctly with other parameters. This refers to the Windows screen settings, as shown in the screenshot. Is there any way to account for this problem?
Image
 
User avatar
jsantos
Site Admin
Posts: 3905
Joined: 20 Jan 2012, 17:18
Contact:

Re: The Canvas.SetLeft() and Canvas.SetTop() methods do not work correctly when scaling the Windows 125% screen

14 Oct 2022, 10:50

Desktop DPI is adding a scale at the root of the tree. Make sure you are using Visual.PointFromScreen to properly transform screen coordinates to local elements.
 
DevFear
Topic Author
Posts: 52
Joined: 29 Jun 2022, 12:36

Re: The Canvas.SetLeft() and Canvas.SetTop() methods do not work correctly when scaling the Windows 125% screen

18 Oct 2022, 10:45

Yes. I found that this is the effect of DPI Scale in Noesis View. If you disable it, then everything starts working without interfering with the code. I'm sorry, but I haven't found any information about what it affects. Can I find out in which cases it should be turned off and on?
 
User avatar
jsantos
Site Admin
Posts: 3905
Joined: 20 Jan 2012, 17:18
Contact:

Re: The Canvas.SetLeft() and Canvas.SetTop() methods do not work correctly when scaling the Windows 125% screen

19 Oct 2022, 01:15

We don't recommend turning it off. You should always use Visual.PointFromScreen as explained in the post above and everything should work correctly.

DPI scaling is necessary, for example, to increase the size of the UI in High DPI displays.
 
DevFear
Topic Author
Posts: 52
Joined: 29 Jun 2022, 12:36

Re: The Canvas.SetLeft() and Canvas.SetTop() methods do not work correctly when scaling the Windows 125% screen

19 Oct 2022, 09:35

Thanks. This is what I was looking for. It helped.

Who is online

Users browsing this forum: Google [Bot] and 88 guests