Page 1 of 1

Getting Index of Currently Selected Line

Posted: Mon Nov 21, 2011 2:19 am
by 15660116
How do I get the index of the currently selected line?

For example, I have several lines using Drawline array:
Dim I1() As Steema.TeeChart.Tools.DrawLineItem
DrawLine5.Pen.Color = DefaultColor2 'Drawing.Color.Gray
DrawLine5.Pen.Width = 1
DrawLine5.Active = True
DrawLine5.EnableSelect = True
DrawLine5.Lines.Clear()
DrawLine5.Pen.Style = Drawing2D.DashStyle.Solid
For i =1 to 5
ReDim Preserve I1(i)
I1(i) = New Steema.TeeChart.Tools.DrawLineItem(DrawLine5)
I1(i).StartPos = New Steema.TeeChart.Drawing.PointDouble(LinX1, LinY1)
I1(i).EndPos = New Steema.TeeChart.Drawing.PointDouble(LinX2, LinY2)
DrawLine5.EnableDraw = False
Next i

I need to get the index of Drawline5.Lines(Index) of the line selected with a mouse

There is a Drawline5_Selecting event but no index property I can find?

Re: Getting Index of Currently Selected Line

Posted: Mon Nov 21, 2011 1:14 pm
by 15660116
I am using the popular method of searching line coordinates to get the index. If you know of an easier method let me know?

Re: Getting Index of Currently Selected Line

Posted: Tue Nov 22, 2011 11:38 am
by narcis
Hi lilo,

You can use DrawLine's clicked method in the chart mouse events where you provide X and Y coordinates and it returns an index or -1 if no line has been clicked.