Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
965
UltraDataChart ChartMouseButtonEventArgs and GetPosition
posted

Hello,

In an attempt to upgrade from 17.1 to 19.1 the below code is no longer working and throws a compile time error.

The GetPosition method no longer exists in ChartMouseButtonEventArgs ?

private void dataChart_SeriesMouseLeftButtonUp ( object sender, ChartMouseButtonEventArgs e )
{

System.Drawing.Point point = new System.Drawing.Point( int.Parse( e.GetPosition().X.ToString() ) + 40, int.Parse( e.GetPosition().Y.ToString() ) - 50 );

}

  • 29930
    Offline posted

    Hello Anthony,

    I have been investigating into this issue you are seeing, and I have reproduced the fact that the method is missing in 19.1. Actually, this method is missing as early as 17.2, as this was when much of our internal code-translation methods changed, and this method appears to have been suppressed.

    I am unsure if this method was intentionally suppressed or not, though, and may have been an oversight, although the implementation of the GetPosition method in our source code for other platforms now appears to accept a UIElement parameter, which is not the simplest thing to get ahold of in Windows Forms, which leads me to believe this may have been intentional. In the case that it wasn’t though, I have logged a new development issue in our internal tracking systems with an ID of 264083 so that our engineering teams can investigate further into this potential oversight. I have also created a private support case for you with an ID of CAS-202448-H6K9D5, which I will be linking this issue to so that you can receive further information after the developer’s review. You can access this support case here.

    As for a workaround in this case, I would recommend that you first use the MousePosition property inherited from Control from your Form. This will get you the MousePosition relative to your Form, and after that, you can get the mouse position of the chart relative to the Form. This will effectively give you the mouse position relative to the chart. It is unfortunate that this will be more complex than simply calling e.GetPosition(), but at the moment, it is necessary.

    Please let me know if you have any other questions or concerns on this matter.