Selecting a DrawLine that is programatically drawn
Posted: Thu Jul 15, 2010 7:24 am
Greetings,
I have problem that I'm not sure how to word properly .. but here goes.
I have several Drawlines that I have programatically drawn on the Chart (pulling the coords from a DB)
I do the same with a number of Series also drawn on the chart programatically.
Now when I want to modify a series I click on it and the TChart_ClickSeries(...) event tells me what the series is and I can go off and do whatever.
Is there a similiar event that I can use to detect when the user has clicked on a DrawLine ?
below is the code I use to draw EACH trendline individually ... rather than having several lines in 1 drawline ... I draw a line then add it to the Tools collection.
This works fine and gives me control over each line .. but the problem I have is what to do when a user loads up their saved trend lines and moves it ... I dont know how to 1) Identify which line has been selected and thus how to update the coords of the line in my DB.
If I could identify a particualr DrawLine I could register the DraggedLine event handler for it and get my coords that way .. unless there is a better way ?
Ive been trying to use the Selector Tool but it seems to find everything except Drawlines.
Cheers Phil.
I have problem that I'm not sure how to word properly .. but here goes.
I have several Drawlines that I have programatically drawn on the Chart (pulling the coords from a DB)
I do the same with a number of Series also drawn on the chart programatically.
Now when I want to modify a series I click on it and the TChart_ClickSeries(...) event tells me what the series is and I can go off and do whatever.
Is there a similiar event that I can use to detect when the user has clicked on a DrawLine ?
below is the code I use to draw EACH trendline individually ... rather than having several lines in 1 drawline ... I draw a line then add it to the Tools collection.
Code: Select all
private void drawTrendLine(ref TChart StockChart, double x0, double y0, double x1, double y1)
{
DrawLine drawLine1 = new DrawLine();
DrawLineItem dItem = new DrawLineItem(drawLine1);
dItem.StartPos = new PointDouble(x0, y0);
dItem.EndPos = new PointDouble(x1, y1);
dItem.Pen.Color = Color.Blue;
dItem.Pen.Width = 2;
dItem.Pen.Transparency = 50;
drawLine1.EnableDraw = false;
drawLine1.EnableSelect = true;
StockChart.Tools.Add(drawLine1);
}
If I could identify a particualr DrawLine I could register the DraggedLine event handler for it and get my coords that way .. unless there is a better way ?
Ive been trying to use the Selector Tool but it seems to find everything except Drawlines.
Cheers Phil.