In a C# form with one picturebox and one button.
by clicking the button, picture box should move from one edge of the form to another edge around the form?
Please provide simple code if possible
What I have tried:
private void timer1_Tick(object sender, EventArgs e)
{
int x = _random.Next(1, 2);
int y = _random.Next(1, 2);
pictureBox1.Left += x;
if (pictureBox1.Location = new Point(180, 0))
{
pictureBox1.Top += y;
}
else if (pictureBox1.Location = new Point(180, 160)
{
pictureBox1.Left += -x;
}
I've failed in all my attempts. #feelinghopeless