I am using code to repeatedly teleport a button to random places every 0.5 seconds, but when I try to click it, it doesn't work.
I've tried using code to refresh the button which solved the visual bugs, but it is still not clickable. I've been using Thread.Sleep(500);
.
int repeat = 100000;
for (int i = 0; i < repeat; i++)
{
int x = 50;
int y = 50;
x += 10;
y += 10;
button1.Location = new Point(x, y);
Random rand = new Random();
x = rand.Next(ClientSize.Width);
y = rand.Next(ClientSize.Height);
button1.Location = new Point(x, y);
Thread.Sleep(500);
button1.Refresh();
}