hit test

  • Thread starter Thread starter Vergassivellaunus
  • Start date Start date
V

Vergassivellaunus

Guest
I have a chart control.

When i move the mosue on it I want to select a portion of x axis, using CursorX.SelectionStart and CursorX.SelectionEnd.

The problem is that i use HitTest to verify if i am inside the graphic portion of chart in this way:


Private Sub Chart_time_x_MouseUp(sender As Object, e As MouseEventArgs) Handles Chart_time_x.MouseUp

Dim ht As DataVisualization.Charting.HitTestResult = Chart_time_x.HitTest(e.X, e.Y)

If ht.ChartElementType = ChartElementType.PlottingArea Then

Dim xx As Double = .ChartArea.AxisX.PixelPositionToValue(e.X)
Me.Chart_time_x.ChartAreas(0).CursorX.SetCursorPixelPosition(New PointF(e.X, e.Y), False)

Else

end if


sometimes if = is not verified, even if e.x and e.y are well inside the chart.

if i substitute the if with:

If Not ht.ChartElementType = ChartElementType.Nothing Then

when i move on title of chart it makes error.

If i remove the title from chart, it seems to signal correctely when exit from chart.

Continue reading...
 
Back
Top