I am using TeeChart v3 and VB 2005 Express.
I have a Rectangle Tool on one of my charts. Is there a way to get the cursor to change to the double arrow (for resizing the rectangle) when the cursor is farther away from the border of the rectangle? I thought I would try changing the tool's CLickTolerance property, but that is a constant.
Jay
Resizing a Rectangle Tool
Hello Jay,
You could set it independently of the tool, using the location parameters and tolerance you decide ...
Eg. This modifies the cursor when within 20 pixels of right and bottom of rectangle:
Regards,
Marc Meumann
You could set it independently of the tool, using the location parameters and tolerance you decide ...
Eg. This modifies the cursor when within 20 pixels of right and bottom of rectangle:
Code: Select all
Cursor origCursor;
private void tChart1_MouseMove(object sender, MouseEventArgs e)
{
if ((Math.Abs(e.X - (rectangleTool1.Left + rectangleTool1.Width)) < 20)
&& (Math.Abs(e.Y - (rectangleTool1.Top + rectangleTool1.Height)) < 20))
this.Cursor = Cursors.SizeNS;
else
this.Cursor = origCursor;
}
private void Form1_Load(object sender, EventArgs e)
{
origCursor = tChart1.Cursor;
}
Marc Meumann
Steema Support
Resizing a Rectangle Tool
Hello Marc,
I should have been more specific. I don't want to just change the cursor when the mouse pointer is farther away from the rectangle, I want the resizing to work from farther away also.
Jay
I should have been more specific. I don't want to just change the cursor when the mouse pointer is farther away from the rectangle, I want the resizing to work from farther away also.
Jay
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Jay,
In that case you should do something like this:
In that case you should do something like this:
Code: Select all
Cursor origCursor;
Boolean resize;
private void tChart1_MouseMove(object sender, MouseEventArgs e)
{
int tmpX = e.X - (rectangleTool1.Left + rectangleTool1.Width);
int tmpY = e.Y - (rectangleTool1.Top + rectangleTool1.Height);
if ((Math.Abs(tmpX) < 20) && (Math.Abs(tmpY) < 20))
{
this.Cursor = Cursors.SizeNS;
if (resize)
{
rectangleTool1.Width += tmpX;
rectangleTool1.Height += tmpY;
}
}
else
this.Cursor = origCursor;
}
private void Form1_Load(object sender, EventArgs e)
{
origCursor = tChart1.Cursor;
resize = false;
}
private void tChart1_MouseDown(object sender, MouseEventArgs e)
{
resize = true;
}
private void tChart1_MouseUp(object sender, MouseEventArgs e)
{
resize = false;
}
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |