Page 1 of 1

Selecting multiple points

Posted: Mon Jun 28, 2004 1:00 pm
by 8122778
Hello!

I want to let the user be able to press the right mouse button, drag the mouse and then finally release the mouse button in a chart, to "select" an area within that chart. (Similar to how you select an area when you zoom, only that you use the left mouse button then.)

When the user releases the right mouse button I want to determine what points in the series lies within the "selected" area. Is this possible?

Best regards
Elisabeth

Posted: Tue Jun 29, 2004 8:13 am
by Pep
Hi Elisabeth,
When the user releases the right mouse button I want to determine what points in the series lies within the "selected" area. Is this possible?
Yes, this can be done using the OnMouseDown and OnMouseUp events to determine the mouse position , i.e. :

Code: Select all

    Private Sub TChart1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TChart1.MouseDown
        ValX = e.X
    End Sub

    Private Sub TChart1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TChart1.MouseUp
        ValX2 = e.X
        Label1.Text = "from point : " + TChart1.Series(0).XScreenToValue(ValX).ToString + " to point : " + TChart1.Series(0).XScreenToValue(ValX2).ToString
    End Sub