Getting Index of Currently Selected Line

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
lilo
Newbie
Newbie
Posts: 62
Joined: Wed Sep 07, 2011 12:00 am

Getting Index of Currently Selected Line

Post by lilo » Mon Nov 21, 2011 2:19 am

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?

lilo
Newbie
Newbie
Posts: 62
Joined: Wed Sep 07, 2011 12:00 am

Re: Getting Index of Currently Selected Line

Post by lilo » Mon Nov 21, 2011 1:14 pm

I am using the popular method of searching line coordinates to get the index. If you know of an easier method let me know?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Getting Index of Currently Selected Line

Post by Narcís » Tue Nov 22, 2011 11:38 am

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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply