Hi,
I use the last version of tee chart (V 32.2763.26082 from july 27).
I have a simple code to draw a line joining one starting point and the point under the mouse when the mouse is moving on my chart.
The line is correctly drawn while the mouse is moving, but it disappears when the mouse stops moving, as if a refresh hidding it occured.
Could you tell me please, how to keep my drawn line when the mouse stop moving.
I join my code.
Thanks,
Anne-Lise
private bool mIsfirstlMouseUp = true;
private Point StartPos;
private Point StopPos;
private FastLine serie;
public Form1()
{
InitializeComponent();
serie = new FastLine();
serie.Add(1, 1);
serie.Add(2, 1);
serie.Add(3, 4);
serie.Add(4, 5);
serie.Add(5, 4);
serie.Add(6, 5);
serie.Add(7, ;
tChart1.AddSeries(serie);
}
private void tChart1_MouseUp(object sender, MouseEventArgs e)
{
if(mIsfirstlMouseUp)
{
mIsfirstlMouseUp = false;
StartPos.X = e.X;
StartPos.Y = e.Y;
}
else
{
mIsfirstlMouseUp = true;
StopPos.X = e.X;
StopPos.Y = e.Y;
MyDrawLine(StopPos,StopPos);
}
}
private void MyDrawLine(Point p1, Point p2)
{
Graphics3D g = tChart1.Graphics3D;
g.MoveTo(p1);
g.LineTo(p2,0);
}
private void tChart1_MouseMove(object sender, MouseEventArgs e)
{
serie.BeginUpdate();
serie.EndUpdate();
Point stopPoint = new Point(Convert.ToInt32(e.X), Convert.ToInt32(e.Y));
MyDrawLine(StartPos,stopPoint);
}
A drawn line during mouse move disappears...
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Anne-Lise,
Why don't you try using DrawLine tool for that instead of implementing your own line drawing?
A solution to your problem would be using the AfterDraw event to plot the line when the mouse is not moving on the chart.
Why don't you try using DrawLine tool for that instead of implementing your own line drawing?
A solution to your problem would be using the AfterDraw event to plot the line when the mouse is not moving on the chart.
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 |