Home › Forums › Software Development › Converting to client coordinates
Tagged: c++, convert, coordinates, pixels
- This topic has 2 replies, 2 voices, and was last updated 8 years ago by Albin Stenström.
- 02/03/2015 at 16:36 #2644Albin StenströmParticipant
The C++ and C SDK has the functions ClientToScreen and ScreenToClient to convert between different sets of coordinates on the screen.
I have not been able to find this in the C# SDK. Is this available somewhere where I haven’t seen it, or is it not available?
Kind Regards04/03/2015 at 17:07 #2651Jenny [Tobii]Participant
The ClientToScreen and ScreenToClient functions used in the EyeX SDK for C/C++ are Windows api functions:
In the EyeX SDK for .Net the corresponding functions are tied to the specific GUI frameworks:
If you are using WPF, you can call “element.PointToScreen(point)” and “element.PointFromScreen(point)” on any element inheriting FrameworkElement to convert back and forth between client and screen coordinates. See WpfInteractor.GetElementBoundsInScreenCoordinates(…) for an example.
If you are using WinForms, you can call “control.PointToScreen(point)” and “control.PointToClient(point)” on any control inheriting from Control to convert back and forth between client and screen coordinates. See FormsInteractor.AddToSnapshot(…) for an example.
If you are using another GUI framework that framework probably has something similar to offer. Otherwise you will have to call the Windows api functions using pinvoke.04/03/2015 at 18:05 #2654Albin StenströmParticipant
Thank you very much for your help!
- You must be logged in to reply to this topic.