detect cursortool and remove it

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
MU
Newbie
Newbie
Posts: 24
Joined: Mon Sep 05, 2005 4:00 am

detect cursortool and remove it

Post by MU » Thu Apr 26, 2007 12:23 pm

hi.. In my Application, the user can add 2 vertical cursortools to a teechart per right mouseclick on the chart in order to show the interval between these 2 cursortools.
The cursortools can be moved (right/left) with the mouse. But because of having a chart which has a lot of X points, it is not practical to use this method (Example: At first: show [15,100] then show [500,550] Actually i use datetime as x values).

So the user must be able to detect the cursortool with mouse and remove it, so that he can add it later again.
I tried to do:

Code: Select all

 private void tChartAll_MouseClick(object sender, MouseEventArgs e)
        {
           ...
            if (e.Button == MouseButtons.Right)
            {
               if(delta1.XValue == tChartAll.Chart.Axes.Bottom.CalcPosPoint(e.X))
               {
                 remove delta1...
               }
....
But it dosent work, althogh the mouse pointer is on the cursortool.
Any Idea? Thanks...

MU
Newbie
Newbie
Posts: 24
Joined: Mon Sep 05, 2005 4:00 am

Post by MU » Thu Apr 26, 2007 12:37 pm

Actually I solved this problem with using a contextmenu. But I would like to learn, whether it is possible to solve it with detecting the cursortool.

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

Post by Narcís » Thu Apr 26, 2007 2:20 pm

Hi MU,

Yes, this is possible. You can do something like this:

Code: Select all

		private void tChart1_MouseClick(object sender, MouseEventArgs e)
		{
			if (e.Button == MouseButtons.Right)
				for (int i = 0; i < tChart1.Tools.Count; i++)
					if ((tChart1.Tools[i] is Steema.TeeChart.Tools.CursorTool) &&
						(((Steema.TeeChart.Tools.CursorTool)tChart1.Tools[i]).Clicked(e.X, e.Y) != Steema.TeeChart.Tools.CursorClicked.None))
					{
						tChart1.Tools.Remove(tChart1.Tools[i]);
					}
		}
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