PIbd-23-Kondratev-N.D.-Gaso.../GasolineTanker/ProjectGasolineTanker/Drawings/DrawingGasolineTanker.cs

52 lines
1.8 KiB
C#
Raw Normal View History

2024-10-03 01:40:53 +04:00
using System;
2024-10-03 01:16:11 +04:00
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using ProjectGasolineTanker.Entities;
2024-10-03 01:40:53 +04:00
namespace ProjectGasolineTanker.Drawings
2024-10-03 01:16:11 +04:00
{
public class DrawingGasolineTanker : DrawingTruck
{
2024-10-03 01:40:53 +04:00
2024-10-03 01:16:11 +04:00
public DrawingGasolineTanker(int speed, double weight, Color bodyColor, Color additionalColor, bool tank, bool wheel, int width, int height) : base(speed, weight, bodyColor, width, height, 130, 70)
{
if (EntityTruck != null)
{
EntityTruck = new EntityGasolineTanker(speed, weight, bodyColor, additionalColor, tank, wheel);
}
2024-10-03 01:40:53 +04:00
2024-10-03 01:16:11 +04:00
}
public override void DrawTransport(Graphics g)
{
if (EntityTruck is not EntityGasolineTanker GasolineTanker)
{
return;
}
2024-10-03 01:40:53 +04:00
Pen pen = new(Color.Black);
Pen additionalPen = new(GasolineTanker.Add_Color);
Brush additionalBrush = new SolidBrush(GasolineTanker.Add_Color);
2024-10-03 01:16:11 +04:00
base.DrawTransport(g);
2024-10-03 01:40:53 +04:00
2024-10-03 01:16:11 +04:00
if (GasolineTanker.Tank)
{
g.FillRectangle(additionalBrush, _startPosX + 45, _startPosY + 53, 35, 20);
g.DrawLine(pen, _startPosX + 45, _startPosY + 53, _startPosX + 80, _startPosY + 73);
g.DrawLine(pen, _startPosX + 80, _startPosY + 53, _startPosX + 45, _startPosY + 73);
2024-10-03 01:40:53 +04:00
}
2024-10-03 01:16:11 +04:00
if (GasolineTanker.Wheel)
{
Brush gr = new SolidBrush(Color.Gray);
g.FillEllipse(additionalBrush, _startPosX + 85, _startPosY + 55, 22, 22);
g.FillEllipse(gr, _startPosX + 87, _startPosY + 57, 18, 18);
g.DrawEllipse(pen, _startPosX + 85, _startPosY + 55, 22, 22);
}
2024-10-03 01:40:53 +04:00
}
2024-10-03 01:16:11 +04:00
}
2024-10-03 01:40:53 +04:00
}