private void Form1_Paint(object sender, PaintEventArgs e)
{
using (Graphics g = e.Graphics)
{
const byte width = 30;
g.Clear(Color.White);
Random r = new Random();
for (int i = 0; i <= this.Width / width; i++)<br> for (int j = 0; j <= this.Width / width; j++)<br> {
g.DrawRectangle(
new Pen(Color.FromArgb(r.Next(0, 255), r.Next(0, 255), r.Next(0, 255)), 3),
width * i,
width * j,
width * (i + 1),
width * (j + 1)
);
}
}
}