diff --git a/PrLaba1/PrLaba1/DiselLoko.cs b/PrLaba1/PrLaba1/DiselLoko.cs index 83520b0..16e78c8 100644 --- a/PrLaba1/PrLaba1/DiselLoko.cs +++ b/PrLaba1/PrLaba1/DiselLoko.cs @@ -16,9 +16,9 @@ public class DiselLoko /// public Color ColorBody { get; private set; } /// - /// цвет колеса + /// цвет бака /// - public Color ColorWheel { get; private set; } + public Color ColorComportament { get; private set; } /// /// Признак наличия трубы /// @@ -33,20 +33,20 @@ public class DiselLoko public double Step => Speed * 100 / Weight; /// - /// + /// Инициализация /// /// /// /// - /// + /// /// /// - public void Init(int speed, double weight, Color colorBody, Color colorWheel, bool isTube, bool isComportament) + public void Init(int speed, double weight, Color colorBody, Color Comportament, bool isTube, bool isComportament) { Speed = speed; Weight = weight; ColorBody = colorBody; - ColorWheel = colorWheel; + ColorComportament = Comportament; IsTube = isTube; IsComportament = isComportament; } diff --git a/PrLaba1/PrLaba1/DrawningDiselLoko.cs b/PrLaba1/PrLaba1/DrawningDiselLoko.cs index cfafb99..5f56c92 100644 --- a/PrLaba1/PrLaba1/DrawningDiselLoko.cs +++ b/PrLaba1/PrLaba1/DrawningDiselLoko.cs @@ -49,14 +49,14 @@ public class DrawningDiselLoko /// Скорость /// Вес /// Цвет тела - /// Цвет колёс + /// Цвет колёс /// Признак езды /// Признак заполнености - public void Init(int speed, double weight, Color colorBody, Color colorWheel, bool isTube, bool isComportament) + public void Init(int speed, double weight, Color colorBody, Color colorComportament, bool isTube, bool isComportament) { DiselLoko = new DiselLoko(); - DiselLoko.Init(speed, weight, colorBody, colorWheel, isTube, isComportament); + DiselLoko.Init(speed, weight, colorBody, colorComportament, isTube, isComportament); _pictureWidth = null; _pictureHeight = null; _startPosX = null; @@ -140,14 +140,14 @@ public class DrawningDiselLoko return true; // вправо case Direction.Right: - if (_startPosX.Value + DiselLoko.Step + _drawingCarWidth/2 < _pictureWidth.Value - _drawingCarWidth) + if (_startPosX.Value + DiselLoko.Step +40 < _pictureWidth.Value - _drawingCarWidth) { _startPosX += (int)DiselLoko.Step; } return true; //вниз case Direction.Down: - if (_startPosY.Value + DiselLoko.Step + _drawingCarWidth / 4 < _pictureHeight.Value - _drawingCarHeight) + if (_startPosY.Value + DiselLoko.Step + 10< _pictureHeight.Value - _drawingCarHeight) { _startPosY += (int)DiselLoko.Step; } @@ -171,7 +171,7 @@ public class DrawningDiselLoko Pen pen = new(Color.Black); Brush additionalBrush = new SolidBrush(DiselLoko.ColorBody); Brush blueBrush = Brushes.Blue; - Brush grayBrush = Brushes.Gray; + Pen blackPen = new Pen(Color.Black, 2); @@ -186,7 +186,9 @@ public class DrawningDiselLoko new Point(_startPosX.Value-10, _startPosY.Value + _drawingCarHeight/2) }; - g.DrawPolygon(blackPen, trainBody); + Brush br = new SolidBrush(DiselLoko.ColorBody); + g.FillPolygon(br, trainBody); + //разделительная линия @@ -294,7 +296,8 @@ public class DrawningDiselLoko new Point(_startPosX.Value +130 , _startPosY.Value + _drawingCarHeight-5), // Нижний правый угол new Point(_startPosX.Value + 110, _startPosY.Value + _drawingCarHeight-5) // Нижний левый угол }; - g.FillPolygon(grayBrush, fuelTank); + Brush br2 = new SolidBrush(DiselLoko.ColorComportament); + g.FillPolygon(br2, fuelTank); g.DrawPolygon(blackPen, fuelTank); } diff --git a/PrLaba1/PrLaba1/FormDiselLoko.cs b/PrLaba1/PrLaba1/FormDiselLoko.cs index 8033581..d99f9cf 100644 --- a/PrLaba1/PrLaba1/FormDiselLoko.cs +++ b/PrLaba1/PrLaba1/FormDiselLoko.cs @@ -50,7 +50,9 @@ Draw(); } - + /// + /// Кнопки движения + /// private void ButtonMove_Click(object sender, EventArgs e) { if (_drawningDiselLoko == null) diff --git a/PrLaba1/PrLaba1/Program.cs b/PrLaba1/PrLaba1/Program.cs index f958083..f24ef74 100644 --- a/PrLaba1/PrLaba1/Program.cs +++ b/PrLaba1/PrLaba1/Program.cs @@ -3,13 +3,11 @@ namespace PrLaba1 internal static class Program { /// - /// The main entry point for the application. + /// /// [STAThread] static void Main() { - // To customize application configuration such as set high DPI settings or default font, - // see https://aka.ms/applicationconfiguration. ApplicationConfiguration.Initialize(); Application.Run(new FormDiselLoko()); }