Assuming that you want to rotate/move images every 3 seconds, you have to provide a method which get two random pictureboxes and replaces images in them instead of replacing pricuteboxes locations (unless, you want to move pictureboxes).
On button click:
Timer1.Interval = 3000
Timer1.Start()
On Timer tick you have to call (for example):
MovePicture()
method.
Think of it! It seems to be easy to implement. You have to define a
List<Point>
to be able to shuffle them by using
Random class[
^]:
List<System.Drawing.Point> picLocations = new List<System.Drawing.Point>()
{
new System.Drawing.Point(0, 0),
new System.Drawing.Point(180, 0),
new System.Drawing.Point(180, 160),
new System.Drawing.Point(0, 160)
};
Random r = new Random();
int f = r.Next(0,2);
System.Drawing.Point first = picLocations[f];
int s = r.Next(2,4);
System.Drawing.Point second = picLocations[s];
picLocations[f] = second;
picLocations[s] = first;
PictureBox1.Location = picLocation[0];
PictureBox2.Location = picLocation[1];
PictureBox3.Location = picLocation[2];
PictureBox4.Location = picLocation[3];
Sample picture locations one timer execution:
X Y
180 160
180 0
0 0
0 160
Good luck!