0
How ı can move new buttons to left in run time in c#?
2 Answers
+ 4
In class scope (global to your form)
//Declare and instantiate a Timer Timer timer = new Timer();
And in the form:--
timer.Interval = 2000; //set interval to 2 seconds timer.Tick += Timer_Tick; //wire up event handler; timer.Start(); //start the timer
private void Timer_Tick(object sender, EventArgs e) { //Move the button by 1 pixel myButton.Location = new Point(myButton.Location.X + 1, myButton.Location.Y) //Stop the timer once the button reaches the right edge if(myButton.Location.X + myButton.Width >= ClientSize.Width) { timer.Stop(); } }
0
The new buttons were formed during the run time, and I want to move these new buttons!
this coding appropriate for that process?
Jamal