Home Forums Software Development Converting to client coordinates

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #2644
    Albin Stenström
    Participant

    Hello!

    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

    #2651
    Jenny [Tobii]
    Participant

    Hi 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.aspx

    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.

    #2654
    Albin Stenström
    Participant

    Thank you very much for your help!

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.