MouseWheel

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
histry
Newbie
Newbie
Posts: 79
Joined: Thu Aug 10, 2006 12:00 am

MouseWheel

Post by histry » Fri Feb 02, 2007 1:26 pm

I would like to use the mousewheel to move a vertical cursor across the screen. I set the cursor on the mouse down and am able to detect the mouse wheel. What would be the best approach to achieve this

Thanks

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

Post by Narcís » Fri Feb 02, 2007 3:59 pm

Hi histry,

You can use TeeChart's MouseWheel event like this:

Code: Select all

		private void Form1_Load(object sender, EventArgs e)
		{
			line1.FillSampleValues();
			cursorTool1.YValue = line1.MinYValue() + ((line1.MaxYValue() - line1.MinYValue()) / 2);

			tChart1.MouseWheel += new MouseEventHandler(tChart1_MouseWheel);
		}

		void tChart1_MouseWheel(object sender, MouseEventArgs e)
		{
			cursorTool1.YValue += e.Delta/10;
		}
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

histry
Newbie
Newbie
Posts: 79
Joined: Thu Aug 10, 2006 12:00 am

Post by histry » Fri Feb 02, 2007 4:06 pm

Thanks that helps. If I have multipe cursors on the screen is the way of determining which cursor the mouse is over as I want to be able to select a cursor and move the selected cursor

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

Post by Narcís » Fri Feb 02, 2007 4:39 pm

Hi histry,

Then you can do something like this:

Code: Select all

		private void Form1_Load(object sender, EventArgs e)
		{
			line1.FillSampleValues();
			cursorTool1.YValue = line1.MinYValue() + ((line1.MaxYValue() - line1.MinYValue()) / 2);
			cursorTool2.YValue = line1.MinYValue() + ((cursorTool1.YValue - line1.MinYValue()) / 2);

			tChart1.MouseWheel += new MouseEventHandler(tChart1_MouseWheel);
		}

		void tChart1_MouseWheel(object sender, MouseEventArgs e)
		{
			foreach (Steema.TeeChart.Tools.Tool  t in tChart1.Tools)
			{
				if (t is Steema.TeeChart.Tools.CursorTool)
				{
					Steema.TeeChart.Tools.CursorTool c = (Steema.TeeChart.Tools.CursorTool)t;
			
					if (c.Clicked(e.X, e.Y) == Steema.TeeChart.Tools.CursorClicked.Horizontal)
					{
						c.YValue += e.Delta / 10;
					}
				}
			}
		}
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