Hi there
I want to use c++ to draw a path
The path is based on two variables, x and y
and x and y will change automatically every second
So I think the flow should be like this:
t=0, (x,y)=(0,0) ->draw a point on the graph
t=1, (x,y)=(2,2)->draw another point on the graph
....
repeat the above steps until the user stop the program.
But I have no idea how can I ask the program to draw point every second and keep all the points in the graph? I tried to use a timer
private: System::Void timer1_Tick(System::Object^ sender, System::EventArgs^ e)
{ ShowGraphics=true; }
so when ShowGraphics is true,
if (IsShowGraphics==false)
return;
Color Black=Color::FromArgb(250, Color::Black);
SolidBrush^ Brush_A = gcnew SolidBrush( Black );
if (x!=0 && y!=0)
{ CallerGDI->FillRectangle(Brush_A,x,y,10,10); //draw point
IsShowGraphics=false;
}
But the program only draws one point at each time AND replaces the previous one. How can I keep the "old" points in the graph?
Thanks for yr time, I really appreciate your help~