turn Gauge

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

turn Gauge

Post by MU » Wed Jan 31, 2007 7:41 am

Hi..
Can I use a gauge as a turnbutton (I dont know how i can call it). I mean: Wenn I click over the gauge, the line in it has to follow the mouse, so the value of the gauege has to change.
Is sth like that possible?
Thansk..

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

Post by Narcís » Wed Jan 31, 2007 12:44 pm

Hi MU,

You can do something like this:

Code: Select all

		private void Form1_Load(object sender, EventArgs e)
		{
			gauges1.Value = 50;
		}

		private bool moveGauge = false;

		private void tChart1_MouseDown(object sender, MouseEventArgs e)
		{
			moveGauge = true;
		}

		private void tChart1_MouseMove(object sender, MouseEventArgs e)
		{
			if (moveGauge)
			{
				int tmpL = gauges1.CalcXPos(0) - gauges1.XRadius;
				int tmpW = (gauges1.CalcXPos(0) + gauges1.XRadius) - tmpL;
				double val = ((double)(e.X - tmpL) / (double)tmpW) * gauges1.Maximum;
				gauges1.Value = val;
			}
		}

		private void tChart1_MouseUp(object sender, MouseEventArgs e)
		{
			moveGauge = false;
		}
BTW: You can call it a knob :wink:.
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