TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
-
Snarkle
- Newbie

- Posts: 91
- Joined: Wed Jun 30, 2010 12:00 am
Post
by Snarkle » Mon Nov 29, 2010 6:42 am
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

--------------------
Cheers Phil.
-
Sandra
- Site Admin

- Posts: 3132
- Joined: Fri Nov 07, 2008 12:00 am
Post
by Sandra » Mon Nov 29, 2010 12:38 pm
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,
-
Narcís
- Site Admin

- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
-
Contact:
Post
by Narcís » Mon Nov 29, 2010 12:51 pm
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

.