0

How ı can move new buttons to left in run time in c#?

20th Jan 2021, 8:51 PM
ZAINAB
ZAINAB - avatar
2 Respostas
+ 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(); } }
20th Jan 2021, 9:56 PM
Jamal Saied
Jamal Saied - avatar
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
22nd Jan 2021, 8:11 AM
ZAINAB
ZAINAB - avatar