Profile Picture

NullReferenceException in HitTest

Posted By Anna Lear 14 Years Ago
Author
Message
Anna Lear
Posted 14 Years Ago
View Quick Profile
Junior Member

Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)

Group: Forum Members
Last Active: 14 Years Ago
Posts: 12, Visits: 1

I'm handling the MouseDown event on NChartControl and checking if the user clicked a DataPoint inside the handler:

NHitTestResult ht = nChartControl1.HitTest(e.X, e.Y);
if(ht.ChartElement == ChartElement.DataPoint)
{
    // do some stuff
}

The chart is also updated multiple times -- it is a scatter plot and I redraw it based on some parameters.

This works most of the time, but sometimes there's a NullReferenceException thrown by the HitTest call. nChartControl1 is not null and the event args have reasonable values.

Any idea what could be going wrong? Thanks.






Similar Topics


Reading This Topic