i am trying to develop a remote desktop apps with c#. so i have couple of question regarding mouse coordinate calculation based on picture box
-
suppose i have picture box and i want to capture mouse coordinate when i will move my mouse
on that picture box in c#? -
if i click at location (200, 300) on my picture box. then how can i determine
programmatically resolution of picture box and convert that (200,300) coordinate based on
that resolution. -
when i will send (x, y) coordinate to other machine and if that pc has resolution have like
1024×768 then what logic i need to use to convert (x, y) according to that pc resolution
if possible help me with small sample code for my question. thanks
Simple, the easiest way is to transform your coordinates to a normalized form (ranging from 0 to 1). Then you can use these normalized coordinates to calculate the mousePosition on another resolution. This way the devices don’t need to know the other devices resolution.
So: