public Image GetRandomImage(int w, int h, Random r)
{
Color randomColor = DesignMode ? Color.Empty : GetRandomColor(r);
Image img = new Bitmap(w, h);
using (Graphics g = Graphics.FromImage(img))
g.FillRectangle(new SolidBrush(randomColor), new Rectangle(0, 0, img.Width, img.Height));
return img;
}
public Color GetRandomColor(Random r)
{
Thread.Sleep(3);
return Color.FromArgb(r.Next(0, 255), r.Next(0, 255), r.Next(0, 255));
}