From b552c74110889e74ced42e35be6b0041a006fcfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B0=D0=BD=D0=B8=D0=BB=D0=B0=20=D0=A1=D0=B5=D0=BB?= =?UTF-8?q?=D1=8F=D0=B5=D0=B2?= Date: Fri, 9 Sep 2022 19:59:28 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9B=D0=B0=D0=B1=D1=80=D0=B0=D1=82=D0=BE?= =?UTF-8?q?=D1=80=D0=BD=D0=B0=D1=8F=201?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Locomative/Locomative/DrawningLocomative.cs | 35 +++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/Locomative/Locomative/DrawningLocomative.cs b/Locomative/Locomative/DrawningLocomative.cs index 6918d8d..48a0bd7 100644 --- a/Locomative/Locomative/DrawningLocomative.cs +++ b/Locomative/Locomative/DrawningLocomative.cs @@ -59,9 +59,40 @@ namespace Locomative } public void DrawTransport(Graphics g) { - if(_startPosX<0 || _startPosY<0 || !_pictureWidth.HasValue || !_pictureHeight.HasValue) return; + if (_startPosX <= 0 || _startPosY <= 0 || !_pictureWidth.HasValue || !_pictureHeight.HasValue) return; + //кисти Pen pen = new(Color.Black); - g.DrawEllipse(pen, _startPosX, _startPosY, 20, 20); + Brush brRed = new SolidBrush(Color.Red); + Brush brBlue = new SolidBrush(Color.Blue); + Brush brGray = new SolidBrush(Color.Gray); + Brush brBlack = new SolidBrush(Color.Black); + //Платформа поезда + g.FillRectangle(brBlack, _startPosX, _startPosY, 90, 40); + //котёл + g.FillRectangle(brBlue, _startPosX + 30, _startPosY + 10, 60, 20); + g.DrawLine(pen, _startPosX + 30, _startPosY + 10, _startPosX + 70, _startPosY + 10); + g.DrawLine(pen, _startPosX + 70, _startPosY + 10, _startPosX + 70, _startPosY + 30); + g.DrawLine(pen, _startPosX + 70, _startPosY + 30, _startPosX + 30, _startPosY + 30); + g.DrawLine(pen, _startPosX + 30, _startPosY + 30, _startPosX + 30, _startPosY + 10); + //крыша поезда + g.FillRectangle(brRed, _startPosX - 2, _startPosY - 2, 34, 44); + g.DrawLine(pen, _startPosX - 2, _startPosY - 2, _startPosX + 32, _startPosY - 2); + g.DrawLine(pen, _startPosX + 32, _startPosY - 2, _startPosX + 32, _startPosY + 42); + g.DrawLine(pen, _startPosX + 32, _startPosY + 42, _startPosX - 2, _startPosY + 42); + g.DrawLine(pen, _startPosX - 2, _startPosY + 42, _startPosX - 2, _startPosY - 2); + //трубы + g.FillEllipse(brGray, _startPosX + 36, _startPosY + 16, 8, 8); + g.FillEllipse(brBlack, _startPosX + 35, _startPosY + 15, 10, 10); + g.FillEllipse(brGray, _startPosX + 56, _startPosY + 16, 8, 8); + g.FillEllipse(brBlack, _startPosX + 55, _startPosY + 15, 10, 10); + g.FillEllipse(brGray, _startPosX + 70, _startPosY + 10, 20, 20); + g.FillEllipse(brBlack, _startPosX + 73, _startPosY + 13, 14, 14); + //бампер + Point point1 = new Point(Convert.ToInt32(_startPosX + 90), Convert.ToInt32(_startPosY)); + Point point2 = new Point(Convert.ToInt32(_startPosX + 110), Convert.ToInt32(_startPosY + 20)); + Point point3 = new Point(Convert.ToInt32(_startPosX + 90), Convert.ToInt32(_startPosY + 40)); + Point[] points = { point1, point2, point3 }; + g.FillPolygon(brGray, points); } public void ChangeBorders(int width, int height) {