namespace WindowsFormsApp1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void btnAnimar_Click(object sender, EventArgs e) { int x = btnAnimar.Location.X; int y = btnAnimar.Location.Y; for (int i = 0; i < 10; i++) { if (i % 2 == 0) { btnAnimar.Location = new System.Drawing.Point(x - 10, y); } else { btnAnimar.Location = new System.Drawing.Point(x + 10, y); } Application.DoEvents(); System.Threading.Thread.Sleep(50); } btnAnimar.Location = new System.Drawing.Point(x, y); } } }
fix invalid codeFri, 17 Mar 2023