using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace задача
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Paint(object sender, PaintEventArgs e)
{
var rand = new Random();
Pen blackPen = new Pen(Color.Black, 1);
int rows = 4;
int cols = 5;
int r = 40;
int d = r * 2;
int step = r + 25;
int startX = 20;
int startY = 20;
Rectangle rect = new Rectangle(startX, startY, d, d);
for (int i = 0; i < rows; i++)
{
for (int j = 0; j < cols; j++)
{
int x = startX + j * step;
int y = startY + i * step;
rect.X = x; rect.Y = y;
HatchBrush hBrush = new HatchBrush(
HatchStyle.Horizontal,
Color.Red,
Color.FromArgb(rand.Next(0, 100), rand.Next(0, 255), rand.Next(0, 255), rand.Next(0, 255)));
e.Graphics.DrawEllipse(blackPen, rect);
e.Graphics.FillEllipse(hBrush, rect);
}
}
}
}
}