Cakistigi zaman değiştirin. Ornek:
void Main()
{
Random r = new Random();
PictureBox p1 = new PictureBox
{
ImageLocation = @"c:\samplePictures\Sunset.jpg",
SizeMode = PictureBoxSizeMode.StretchImage,
Bounds = new Rectangle { X = 0, Y = 0, Height = 100, Width = 100 }
};
PictureBox p2 = new PictureBox
{
ImageLocation = @"c:\samplePictures\winter.jpg",
SizeMode = PictureBoxSizeMode.StretchImage,
Bounds = new Rectangle { X = 150, Y = 150, Height = 100, Width = 100 }
};
System.Windows.Forms.Timer tmr = new System.Windows.Forms.Timer { Interval = 1000 };
Form f = new Form { Height = 600, Width = 800 };
f.Controls.Add(p1);
f.Controls.Add(p2);
tmr.Tick += (sender, e) =>
{
p1.Left = r.Next(f.Width) - p1.Width;
p1.Top = r.Next(f.Height) - p1.Height;
p2.Left = r.Next(f.Width) - p2.Width;
p2.Top = r.Next(f.Height) - p2.Height;
var b1 = p1.Bounds;
var b2 = p2.Bounds;
if (b1.Right > b1.Left && b1.Left < b2.Right && b1.Bottom > b2.Top && b1.Top < b2.Bottom)
{
tmr.Stop();
p1.SetBounds(b2.Left - p1.Width, b2.Top - p1.Height, b1.Width, b1.Height);
}
};
f.Show();
tmr.Start();
}
How to create a Minimal, Reproducible Example
The way to Go.
World's most advanced open source (object-) relational
Database.
Flutter (for mobile, for web & desktop.