Page 1 of 1
DRawLine Handles can I detect whether I've got hold of one.
Posted: Mon Nov 29, 2010 6:42 am
by 8751509
Greetings,
Is there a way to determine if you currently have selected a handle on the drawline and in particular WHICH handle you have under the mouse ...
I suppose I could grab the mouse coords -- convert them to price and index values and then see whether they fall close enough to say yep .. thats the StartPos end of the Line ...
Is there a more bullet proof way of knowing what end of the tiger one currently has hold of
P.S. hey how come I'm still a "newbie" ... I would think by now I'm an intermediate at asking formum questions .... maybe I need to upload more pictures
Re: DRawLine Handles can I detect whether I've got hold of one.
Posted: Mon Nov 29, 2010 12:38 pm
by 10050769
Hello Phil,
I suggest you use
MouseClickEvent or
MouseDownEvent or
MouseMoveEvent and
DrawLineItems as do in next example to calculated StartPos and EndPos of DrawLine Tool.
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
private void InitializeChart()
{
Steema.TeeChart.Styles.Candle candle1 = new Steema.TeeChart.Styles.Candle(tChart1.Chart);
candle1.FillSampleValues();
Steema.TeeChart.Tools.DrawLine drawline = new Steema.TeeChart.Tools.DrawLine(tChart1.Chart);
drawline.Pen.Color = Color.Red;
drawline.Pen.Width = 2;
drawline.EnableDraw = true;
tChart1.Axes.Bottom.Labels.Angle = 90;
tChart1.MouseClick += new MouseEventHandler(tChart1_MouseClick);
}
void tChart1_MouseClick(object sender, MouseEventArgs e)
{
Steema.TeeChart.Tools.DrawLineItem drawlineItems = (tChart1.Tools[0] as Steema.TeeChart.Tools.DrawLine).Clicked(e.X, e.Y);
if (drawlineItems != null)
{
if (drawlineItems.StartHandle.Contains(e.X, e.Y))
{
this.Text = "Start Handle X value: " + (DateTime.FromOADate(drawlineItems.StartPos.X)).ToShortDateString() + "Start Handle Y value: " + ((int)drawlineItems.StartPos.Y).ToString();
}
else if (drawlineItems.EndHandle.Contains(e.X, e.Y))
{
this.Text = "Start Handle X value: " + (DateTime.FromOADate(drawlineItems.EndPos.X)).ToShortDateString() + "Start Handle Y value: " + ((int)drawlineItems.EndPos.Y).ToString();
}
}
}
Could you tell us if previous code works as you want?
I hope will helps.
Thanks,
Re: DRawLine Handles can I detect whether I've got hold of one.
Posted: Mon Nov 29, 2010 12:51 pm
by narcis
Hi Phil,
P.S. hey how come I'm still a "newbie" ... I would think by now I'm an intermediate at asking formum questions .... maybe I need to upload more pictures
You need 100 posts to get "Advanced" user rank and one thousand for "Guru". We might consider adding intermediate ranks
.