using System; using System.Collections.Generic; using System.Drawing; using System.Text; namespace WinFormsApp1 { class MultiTraktorDraw : TractorDraw { public void SetDopColor(Color color) { ((MultiTraktor)Tractor).DopColor = color; } public MultiTraktorDraw(int speed, float weight, Color bodyColor, Color dopColor, bool dopahead, bool dopbehind) : base(speed, weight, bodyColor, 188, 100) { Tractor = new MultiTraktor(speed, weight, bodyColor, dopColor, dopahead, dopbehind); } public override void DrawEntity(Graphics g) { if (Tractor is not MultiTraktor multiTraktor) { return; } if (!DrawCheck()) { return; } Pen pen_Black_1pxl = new Pen(Color.Black, 1); Pen pen_Black_2pxl = new Pen(Color.Black, 2); Brush brBlack = new SolidBrush(Color.Black); Brush dopBrush = new SolidBrush(multiTraktor.DopColor); PointF point1; PointF point2; PointF point3; PointF point4; g.DrawRectangle(pen_Black_1pxl, startPosX, startPosY + 8, 4, 35); g.DrawRectangle(pen_Black_1pxl, startPosX + 33, startPosY + 34, 10, 15); if (multiTraktor.dopBehind) { point1 = new PointF(startPosX, startPosY + 8); point2 = new PointF(startPosX + 33, startPosY + 41); point3 = new PointF(startPosX + 33, startPosY + 34); point4 = new PointF(startPosX + 7, startPosY + 8); PointF[] curvePoints = { point1, point2, point3, point4 }; g.FillPolygon(dopBrush, curvePoints); g.DrawPolygon(pen_Black_1pxl, curvePoints); point1 = new PointF(startPosX + 6, startPosY + 8 + 15); point2 = new PointF(startPosX + 6, startPosY + 8 + 35); point3 = new PointF(startPosX + 26, startPosY + 8 + 35); PointF[] curvePoints2 = { point1, point2, point3 }; g.FillPolygon(dopBrush, curvePoints2); g.DrawPolygon(pen_Black_1pxl, curvePoints2); } startPosX += 43; base.DrawEntity(g); startPosX -= 43; if (multiTraktor.dopAhead) { point1 = new PointF(startPosX + 43 + 102, startPosY + 30); point2 = new PointF(startPosX + 43 + 102, startPosY + 65); point3 = new PointF(startPosX + 43 + 137, startPosY + 65); PointF[] curvePoints3 = { point1, point2, point3 }; g.FillPolygon(dopBrush, curvePoints3); g.DrawPolygon(pen_Black_1pxl, curvePoints3); } } } }