Hi,
Whenever the user moves the cursor, I want to display some text in a standard position next to the cursor, say at 3/4 the height of the cursor.
So I want to get the location of the cursor, but using XYalue and YValue doesn't work.
What alternative properties are there so i can set the x and y coordinates of the TextOut method in the AfterDraw event?
Thanks.
Drawing next to cursor
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Agrilink,
You can use TeeChart's MouseMove event to get the cursor coordinates and do something like:
If you want that feature for a cursor tool you can use its Change event to get the coordinates and something like this:
You can use TeeChart's MouseMove event to get the cursor coordinates and do something like:
Code: Select all
private void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
g.TextOut(X, Y-10, "My Custom Text");
}
private int X, Y;
private void tChart1_MouseMove(object sender, MouseEventArgs e)
{
X = e.X;
Y = e.Y;
tChart1.Invalidate();
}
Code: Select all
private void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
System.Drawing.Rectangle Rect = tChart1.Chart.ChartRect;
Y=(Rect.Height / 4) * 3;
g.TextOut(X, Y, "My Custom Text");
}
private int X,Y;
private void cursorTool1_Change(object sender, Steema.TeeChart.Tools.CursorChangeEventArgs e)
{
X = e.x;
}
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 |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Agrilink,
Yes, that's right but you can easily solve it by adding the line below to the KeyDown event:
Yes, that's right but you can easily solve it by adding the line below to the KeyDown event:
Code: Select all
X = tChart1.Axes.Bottom.CalcPosValue(cursorTool1.XValue);
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 |