Page 1 of 1

Mouse cursor over legend does not change

Posted: Fri Aug 17, 2007 11:25 pm
by 8739068
When interacting with a chart, I set the TeeChart.Cursor to something other than the Default mouse cursor. I found that if I move the mouse over the chart legend the mouse cursor remains the same. I would like it to go back to Default. I found the legend does not provide any properties, events, or methods to minipulate the mouse cursor. It appears to be by design.

Is there any way to change the mouse cursor while it is over the legend the return the mouse cursor back when the mouse leaves the legend?

Posted: Mon Aug 20, 2007 9:27 am
by narcis
Hi Mike,

Yes, you can use legend's clicked method and MouseMove event like this:

Code: Select all

		private void tChart1_MouseMove(object sender, MouseEventArgs e)
		{
			if (tChart1.Legend.Clicked(e.X,e.Y) != -1)
			{
				tChart1.Cursor = Cursors.Cross;
			}
			else
			{
				tChart1.Cursor = Cursors.Default;
			}
		}

Example code does not accomplish my requirement

Posted: Mon Aug 20, 2007 3:40 pm
by 8739068
The example you provided works fine if I want the cursor to change only if I click the left mouse button. I want to change the cursor anytime the mouse is hovering within the bounds of the legend.

Ideally I would like the mouse cursor to be set to Cursors.Default while it is within the bound of the legend. Upon leaving the bounds of the legend, the mouse cursor changes to what it was when over the chart's graphing area.

I guess I can make the necessary calculations to simulate this, it would be a nice feature if the legend was like a control and would control the mouse events like standard winform controls.

If you don't mind adding this to a list of requested features for future products.

Posted: Mon Aug 20, 2007 3:48 pm
by narcis
Hi Mike,

The example above works as you request for me. Are you using the same event as in the example? The MouseMove event should work even without pressing any mouse button.
I guess I can make the necessary calculations to simulate this, it would be a nice feature if the legend was like a control and would control the mouse events like standard winform controls.
Ok, I've added this to our wish-list to be considered for inclusion in future releases.