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)
	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

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~

This is a frustrating thing to deal with. I looked at it as such:
Make a class that holds your data points in a list and has a member method Draw, drawing each point up until time.

void Points::Draw(Graphics^ g , int time)
			Pen ^ mypen = gcnew Pen(Color::Black);
		for(int i = 0;i<time;i++)

In form1.h have 2 event handlers

private: System::Void Form1_Paint(System::Object^  sender, System::Windows::Forms::PaintEventArgs^  e) {
	private: System::Void timer1_Tick(System::Object^  sender, System::EventArgs^  e) {

Use an interval on the timer of 1000 and start it in the Form1 constructor. Each time the timer ticks (1 sec) it will paint all of the dots up until that time. I'm sure there's a better way to do it but there may be no escaping the need to repaint all of them on each new dot.

thank you jonsca, it works^^