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, 6 months ago by
Albin Stenström.
- AuthorPosts
- 02/03/2015 at 16:36 #2644
Albin Stenström
ParticipantHello!
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 Regards
04/03/2015 at 17:07 #2651Jenny [Tobii]
ParticipantHi Albin,
The ClientToScreen and ScreenToClient functions used in the EyeX SDK for C/C++ are Windows api functions:
https://msdn.microsoft.com/en-us/library/windows/desktop/dd183434%28v=vs.85%29.aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/dd162952%28v=vs.85%29.aspxIn 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öm
ParticipantThank you very much for your help!
- AuthorPosts
- You must be logged in to reply to this topic.