May 19, 2020
"Избушка на курьих ножках"
private void Form1_Paint(object sender, PaintEventArgs e)
{
Graphics Painter = e.Graphics;
//травка
{
Brush brush = new SolidBrush(Color.MidnightBlue);
Painter.FillRectangle(brush, 0, 0, 800, 250);
Point point1 = new Point(0, 225);
Point point2 = new Point(0, 450);
Color colorG = Color.ForestGreen;
Color colorDG = Color.DarkGreen;
Brush brushH = new LinearGradientBrush(point1, point2, colorDG, colorG);
Painter.FillRectangle(brushH, 0, 250, 800, 250);
}
//луна
{
Point pS = new Point(180, 200); Point pS2 = new Point(0, 100);
Color colorS = Color.Aqua;
Color colorS2 = Color.White;
Brush grad = new LinearGradientBrush(pS, pS2, colorS, colorS2);
Painter.FillEllipse(grad, 30, 30, 80, 80);
} {
Point pL = new Point(180, 200); Point pL2 = new Point(0, 100);
Color colorS = Color.MidnightBlue;
Color colorS2 = Color.MidnightBlue;
Brush grad = new LinearGradientBrush(pL, pL2, colorS, colorS2);
Painter.FillEllipse(grad, 20, 20, 70, 70);
}
//фасад и крыша
{
Brush brushDom = new SolidBrush(Color.Sienna);
Painter.FillRectangle(brushDom, 200, 180, (800 - 100) / 2, 200);
Point pKri = new Point(180, 200); Point pKri2 = new Point(540, 90);
Color colorKri = Color.Tomato;
Color colorKri2 = Color.Firebrick;
Brush gradKri = new LinearGradientBrush(pKri, pKri2, colorKri, colorKri2); Point[] points = new Point[5];
{
points[0] = new Point(180, 200);
points[1] = new Point(200, 110);
points[2] = new Point(540, 110);
points[3] = new Point(570, 200);
points[4] = new Point(180, 200);
Painter.FillPolygon(gradKri, points);
}
//дверь
Point[] Door = new Point[5];
Point pL = new Point(430, 380); Point pL2 = new Point(540, 380);
Color colorS = Color.SaddleBrown;
Color colorS2 = Color.RosyBrown;
Brush grad = new LinearGradientBrush(pL, pL2, colorS, colorS2); {
Door[0] = new Point(430, 380);
Door[1] = new Point(430, 260);
Door[2] = new Point(540, 260);
Door[3] = new Point(540, 380);
Door[4] = new Point(430, 380);
Painter.FillPolygon(grad, Door);
}
}
//забор
{
Pen penX = new Pen(Color.Crimson, 10);
Painter.DrawLine(penX, 0, 400, 800, 400);
Painter.DrawLine(penX, 0, 450, 800, 450); for(int i = 0; i < 100; i++)
{
Painter.DrawLine(penX, i * 20, 390, i * 20, 470);
}
}
//окна
{
Point[] Okno = new Point[5];
Point pL = new Point(240, 330); Point pL2 = new Point(370, 220);
Color colorS = Color.Cyan;
Color colorS2 = Color.DarkCyan;
Brush grad = new LinearGradientBrush(pL, pL2, colorS, colorS2); {
Okno[0] = new Point(240, 330);
Okno[1] = new Point(240, 220);
Okno[2] = new Point(370, 220);
Okno[3] = new Point(370, 330);
Okno[4] = new Point(240, 330);
Painter.FillPolygon(grad, Okno);
}
}
}