Загрузка данных


using System; 
using System.Drawing;
using System.Windows.Forms;

namespace zadani1
{
    public partial class Form1 : Form
    {
        private Random rand = new Random();
        public Form1()
        {
            InitializeComponent();
            this.ClientSize = new Size(800, 600);

        }

        private void Form1_Paint(object sender, PaintEventArgs e)
        {
            Graphics g = e.Graphics;
            for (int i = 0; i < 50; i++)
            {
                int w = rand.Next(20, 150);
                int h = rand.Next(20, 150);
                int x = rand.Next(0, this.ClientSize.Width - w);
                int y = rand.Next(0, this.ClientSize.Height - h);
                Color color = Color.FromArgb(rand.Next(256), rand.Next(256), rand.Next(256));
                using (Brush brush = new SolidBrush(color))
                {
                    g.FillRectangle(brush, x, y, w, h);
                }
            }
        }
    }
}