Jump to content

Calculating coordinates between different monitors


Info
 Share

Recommended Posts

Let's say my monitor resolution is 800x600 and my friend's monitor resolution is 1500x1000.

How do I calculate a pixel coordinate in my screen to the coordinate of my friend's screen?

Like if I choose the 400,300 pixel I should get 750,500.

I have both my resolution and my friend resolution as vars and the pixel coordinates as well

Edited by Info
Link to comment
Share on other sites

A very simple math calculation:

$myres_w= 800 ;@DesktopWidth
$myres_h = 600 ;@DesktopHeight
$friends_w = 1500
$friends_h = 1000

$my_x = 400
$my_y = 300

$friends_x = Round(($my_x / $myres_w) * $friends_w, 0)
$friends_y = Round(($my_y / $myres_h) * $friends_h, 0)

MsgBox(0, "Test", "Friend's coordinate: " & $friends_x & " x " & $friends_y)

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...