diff --git a/Laba1Loco/Laba1Loco.sln b/Laba1Loco/Laba1Loco.sln
new file mode 100644
index 0000000..6263144
--- /dev/null
+++ b/Laba1Loco/Laba1Loco.sln
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.5.33424.131
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Laba1Loco", "Laba1Loco\Laba1Loco.csproj", "{9F9C9603-3EF7-403E-A895-04EA0CBC5586}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {9F9C9603-3EF7-403E-A895-04EA0CBC5586}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {9F9C9603-3EF7-403E-A895-04EA0CBC5586}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {9F9C9603-3EF7-403E-A895-04EA0CBC5586}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {9F9C9603-3EF7-403E-A895-04EA0CBC5586}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {EF8E2621-D5D1-4E60-BC18-2388B1EB5E59}
+ EndGlobalSection
+EndGlobal
diff --git a/Laba1Loco/Laba1Loco/App.config b/Laba1Loco/Laba1Loco/App.config
new file mode 100644
index 0000000..56efbc7
--- /dev/null
+++ b/Laba1Loco/Laba1Loco/App.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Laba1Loco/Laba1Loco/Direction.cs b/Laba1Loco/Laba1Loco/Direction.cs
new file mode 100644
index 0000000..b30b47d
--- /dev/null
+++ b/Laba1Loco/Laba1Loco/Direction.cs
@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Laba1Loco
+{
+ public enum Direction
+ {
+ ///
+ /// Вверх
+ ///
+ Up = 1,
+ ///
+ /// Вниз
+ ///
+ Down = 2,
+ ///
+ /// Влево
+ ///
+ Left = 3,
+ ///
+ /// Вправо
+ ///
+ Right = 4
+ }
+
+}
diff --git a/Laba1Loco/Laba1Loco/DrawingLoco.cs b/Laba1Loco/Laba1Loco/DrawingLoco.cs
new file mode 100644
index 0000000..212f248
--- /dev/null
+++ b/Laba1Loco/Laba1Loco/DrawingLoco.cs
@@ -0,0 +1,393 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace Laba1Loco
+{
+ internal class DrawingLoco
+ {
+ ///
+ /// Класс-сущность
+ ///
+ public EntityLoco EntityLoco { get; private set; }
+ ///
+ /// Ширина окна
+ ///
+ private int _pictureWidth;
+ ///
+ /// Высота окна
+ ///
+ private int _pictureHeight;
+ ///
+ /// Левая координата прорисовки локомотива
+ ///
+ private int _startPosX;
+ ///
+ /// Верхняя кооридната прорисовки локомотива
+ ///
+ private int _startPosY;
+ ///
+ /// Ширина прорисовки локомотива
+ ///
+ private int _locoWidth => (EntityLoco?.FuelTank ?? false) ? 169 : 83;
+ ///
+ /// Высота прорисовки локомотива
+ ///
+ private readonly int _locoHeight = 41;
+ ///
+ /// Инициализация свойств
+ ///
+ /// Скорость
+ /// Вес
+ /// Цвет кузова
+ /// Дополнительный цвет
+ /// Признак наличия трубы
+ /// Признак наличия бака
+ /// Признак наличия паровозной полосы
+ /// Ширина картинки
+ /// Высота картинки
+ /// true - объект создан, false - проверка не пройдена, нельзя создать объект в этих размерах
+ public bool Init(int speed, double weight, Color bodyColor, Color additionalColor, bool tube, bool fuelTank, bool locoLine, int width, int height)
+ {
+ _pictureWidth = width;
+ _pictureHeight = height;
+ if (_pictureHeight < _locoHeight || _pictureWidth < _locoWidth)
+ return false;
+ EntityLoco = new EntityLoco();
+ EntityLoco.Init(speed, weight, bodyColor, additionalColor, tube, fuelTank, locoLine);
+
+ return true;
+ }
+ ///
+ /// Установка позиции
+ ///
+ /// Координата X
+ /// Координата Y
+ public void SetPosition(int x, int y)
+ {
+ _startPosX = Math.Min(x, _pictureWidth-_locoWidth);
+ _startPosY = Math.Min(y, _pictureHeight-_locoHeight);
+ }
+ ///
+ /// Изменение направления перемещения
+ ///
+ /// Направление
+ public void MoveTransport(Direction direction)
+ {
+ if (EntityLoco == null){
+ return;
+ }
+ switch (direction)
+ {
+ //влево
+ case Direction.Left:
+ if (_startPosX - EntityLoco.Step > 0)
+ {
+ _startPosX -= (int)EntityLoco.Step;
+ }
+ break;
+ //вверх
+ case Direction.Up:
+ if (_startPosY - EntityLoco.Step > 0)
+ {
+ _startPosY -= (int)EntityLoco.Step;
+ }
+ break;
+ // вправо
+ case Direction.Right:
+ if (_startPosX + _locoWidth + EntityLoco.Step < _pictureWidth)
+ {
+ _startPosX += (int)EntityLoco.Step;
+ }
+ break;
+ //вниз
+ case Direction.Down:
+ if (_startPosY + _locoHeight + EntityLoco.Step < _pictureHeight)
+ {
+ _startPosY += (int)EntityLoco.Step;
+ }
+ break;
+ }
+ }
+ ///
+ /// класс облака
+ ///
+ class cloud
+ {
+ ///
+ /// просто рандом
+ ///
+ Random random;
+ ///
+ /// координаты облака
+ ///
+ int x, y;
+ ///
+ /// размер облака
+ ///
+ int size;
+ ///
+ /// прозрачность облака
+ ///
+ public int opasity;
+ ///
+ /// intialisation облака
+ ///
+ /// координата облака по горизонтали
+ /// координата облака по вертикали
+ public cloud(int x_, int y_)
+ {
+ random = new Random();
+ x = x_;
+ y = y_ - 5;
+ size = 10;
+ opasity = 255;
+ }
+ ///
+ /// шаг времени для облака
+ ///
+ public void timeTick()
+ {
+ y -= 3;
+ size += 5;
+ opasity -= 20;
+
+ /// добавляем случайности
+ y += random.Next(-1, 2);
+ x += random.Next(-1, 2);
+ size += random.Next(-1, 2);
+ opasity += random.Next(-1, 2);
+ }
+ ///
+ /// отрисовка облака
+ ///
+ ///
+ public void Draw(Graphics g)
+ {
+ g.DrawEllipse(new Pen(Color.FromArgb(opasity, Pens.Gray.Color)), x - size / 2, y-size/2, size, size);
+ }
+
+ }
+ ///
+ /// массив облачков
+ ///
+ List clouds = new List();
+
+ ///
+ /// шаг времени для облаков
+ ///
+ public void timeTick()
+ {
+ if (EntityLoco != null)
+ {
+ if (clouds.Count < 10)
+ clouds.Add(new cloud(_startPosX+40, EntityLoco.Tube ? _startPosY : _startPosY + 9));
+ }
+ for (int i = 0; i < clouds.Count; i++)
+ {
+ if (i < clouds.Count)
+ {
+ clouds[i].timeTick();
+ if (clouds[i].opasity < 20)
+ {
+ clouds.RemoveAt(i);
+ }
+ }
+ }
+ }
+ ///
+ /// Прорисовка объекта
+ ///
+ ///
+ public void DrawTransport(Graphics g)
+ {
+ if (EntityLoco == null)
+ {
+ return;
+ }
+ Pen pen = new Pen(EntityLoco.BodyColor);
+ Brush brush = new SolidBrush(EntityLoco.BodyColor);
+ Pen additionalPen = new Pen(EntityLoco.AdditionalColor);
+ Brush additionalBrush = new SolidBrush(EntityLoco.AdditionalColor);
+
+ //smoke
+ foreach(var it in clouds){
+ it.Draw(g);
+ }
+
+ // body
+ g.DrawLines(pen,
+ new Point[] {
+ new Point(_startPosX + 8, _startPosY+10),
+ new Point(_startPosX + 79, _startPosY+10),
+ new Point(_startPosX + 79, _startPosY+32),
+ new Point(_startPosX + 4, _startPosY+32),
+ new Point(_startPosX + 4, _startPosY+20),
+ new Point(_startPosX + 8, _startPosY+10),
+ }
+ );
+ g.DrawLines(pen,
+ new Point[] {
+ new Point(_startPosX + 4, _startPosY+21),
+ new Point(_startPosX + 29, _startPosY+21),
+ new Point(_startPosX + 29, _startPosY+14),
+ new Point(_startPosX + 37, _startPosY+14),
+ new Point(_startPosX + 37, _startPosY+21),
+ new Point(_startPosX + 79, _startPosY+21),
+ new Point(_startPosX + 37, _startPosY+21),
+ new Point(_startPosX + 37, _startPosY+29),
+ new Point(_startPosX + 29, _startPosY+29),
+ new Point(_startPosX + 29, _startPosY+21),
+ }
+ );
+
+ // trucks
+ g.FillPolygon(brush,
+ new Point[] {
+ new Point(_startPosX + 0, _startPosY+37),
+ new Point(_startPosX + 5, _startPosY+33),
+ new Point(_startPosX + 32, _startPosY+33),
+ new Point(_startPosX + 36, _startPosY+37),
+ }
+ );
+ g.FillPolygon(brush,
+ new Point[] {
+ new Point(_startPosX + 44, _startPosY+37),
+ new Point(_startPosX + 49, _startPosY+33),
+ new Point(_startPosX + 76, _startPosY+33),
+ new Point(_startPosX + 80, _startPosY+37),
+ }
+ );
+
+ //back
+ g.FillPolygon(brush,
+ new Point[] {
+ new Point(_startPosX + 79, _startPosY+12),
+ new Point(_startPosX + 82, _startPosY+12),
+ new Point(_startPosX + 82, _startPosY+30),
+ new Point(_startPosX + 79, _startPosY+30),
+ }
+ );
+
+ //windows
+ g.DrawRectangle(Pens.Blue, _startPosX + 10, _startPosY + 12, 6, 7);
+ g.DrawRectangle(Pens.Blue, _startPosX + 19, _startPosY + 12, 6, 7);
+ g.DrawRectangle(Pens.Blue, _startPosX + 72, _startPosY + 12, 6, 7);
+
+ //wheels
+ g.FillEllipse(brush, _startPosX + 3, _startPosY + 34, 8, 8);
+ g.FillEllipse(additionalBrush, _startPosX + 4, _startPosY + 35, 6, 6);
+ g.FillEllipse(brush, _startPosX + 26, _startPosY + 34, 8, 8);
+ g.FillEllipse(additionalBrush, _startPosX + 27, _startPosY + 35, 6, 6);
+ g.FillEllipse(brush, _startPosX + 46, _startPosY + 34, 8, 8);
+ g.FillEllipse(additionalBrush, _startPosX + 47, _startPosY + 35, 6, 6);
+ g.FillEllipse(brush, _startPosX + 72, _startPosY + 34, 8, 8);
+ g.FillEllipse(additionalBrush, _startPosX + 73, _startPosY + 35, 6, 6);
+
+ if (EntityLoco.Tube)
+ {
+ g.DrawLines(additionalPen,
+ new Point[] {
+ new Point(_startPosX + 40, _startPosY+9),
+ new Point(_startPosX + 40, _startPosY+3),
+ new Point(_startPosX + 45, _startPosY+3),
+ new Point(_startPosX + 41, _startPosY+3),
+ new Point(_startPosX + 41, _startPosY),
+ new Point(_startPosX + 44, _startPosY),
+ new Point(_startPosX + 44, _startPosY+3),
+ new Point(_startPosX + 45, _startPosY+3),
+ new Point(_startPosX + 45, _startPosY+9),
+ });
+ }
+ if (EntityLoco.LocoLine)
+ {
+ g.DrawLines(additionalPen,
+ new Point[] {
+ new Point(_startPosX + 60, _startPosY+10),
+ new Point(_startPosX + 38, _startPosY+32),
+ });
+ g.DrawLines(additionalPen,
+ new Point[] {
+ new Point(_startPosX + 65, _startPosY+10),
+ new Point(_startPosX + 43, _startPosY+32),
+ });
+ g.DrawLines(additionalPen,
+ new Point[] {
+ new Point(_startPosX + 70, _startPosY+10),
+ new Point(_startPosX + 48, _startPosY+32),
+ });
+ }
+ if (EntityLoco.FuelTank)
+ {
+ // body
+ g.DrawLines(pen,
+ new Point[] {
+ new Point(_startPosX + 89, _startPosY+10),
+ new Point(_startPosX + 164, _startPosY+10),
+ new Point(_startPosX + 164, _startPosY+32),
+ new Point(_startPosX + 89, _startPosY+32),
+ new Point(_startPosX + 89, _startPosY+10),
+ }
+ );
+ g.DrawLines(pen,
+ new Point[] {
+ new Point(_startPosX + 89, _startPosY+21),
+ new Point(_startPosX + 164, _startPosY+21),
+ }
+ );
+
+ // trucks
+ g.FillPolygon(brush,
+ new Point[] {
+ new Point(_startPosX + 0+85, _startPosY+37),
+ new Point(_startPosX + 5+85, _startPosY+33),
+ new Point(_startPosX + 32+85, _startPosY+33),
+ new Point(_startPosX + 36+85, _startPosY+37),
+ }
+ );
+ g.FillPolygon(brush,
+ new Point[] {
+ new Point(_startPosX + 44+85, _startPosY+37),
+ new Point(_startPosX + 49+85, _startPosY+33),
+ new Point(_startPosX + 76+85, _startPosY+33),
+ new Point(_startPosX + 80+85, _startPosY+37),
+ }
+ );
+
+ //front
+ g.FillPolygon(brush,
+ new Point[] {
+ new Point(_startPosX + 86, _startPosY+12),
+ new Point(_startPosX + 89, _startPosY+12),
+ new Point(_startPosX + 89, _startPosY+30),
+ new Point(_startPosX + 86, _startPosY+30),
+ }
+ );
+
+ //back
+ g.FillPolygon(brush,
+ new Point[] {
+ new Point(_startPosX + 79+85, _startPosY+12),
+ new Point(_startPosX + 82+85, _startPosY+12),
+ new Point(_startPosX + 82+85, _startPosY+30),
+ new Point(_startPosX + 79+85, _startPosY+30),
+ }
+ );
+
+ //wheels
+ g.FillEllipse(brush, _startPosX + 3 + 85, _startPosY + 34, 8, 8);
+ g.FillEllipse(additionalBrush, _startPosX + 4, _startPosY + 35, 6, 6);
+ g.FillEllipse(brush, _startPosX + 26 + 85, _startPosY + 34, 8, 8);
+ g.FillEllipse(additionalBrush, _startPosX + 27, _startPosY + 35, 6, 6);
+ g.FillEllipse(brush, _startPosX + 46 + 85, _startPosY + 34, 8, 8);
+ g.FillEllipse(additionalBrush, _startPosX + 47, _startPosY + 35, 6, 6);
+ g.FillEllipse(brush, _startPosX + 72 + 85, _startPosY + 34, 8, 8);
+ g.FillEllipse(additionalBrush, _startPosX + 73, _startPosY + 35, 6, 6);
+ }
+ }
+ }
+}
diff --git a/Laba1Loco/Laba1Loco/EntityLoco.cs b/Laba1Loco/Laba1Loco/EntityLoco.cs
new file mode 100644
index 0000000..3d68c9a
--- /dev/null
+++ b/Laba1Loco/Laba1Loco/EntityLoco.cs
@@ -0,0 +1,67 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Laba1Loco
+{
+ internal class EntityLoco
+ {
+ ///
+ /// Скорость
+ ///
+ public int Speed { get; private set; }
+ ///
+ /// Вес
+ ///
+ public double Weight { get; private set; }
+ ///
+ /// Основной цвет
+ ///
+ public Color BodyColor { get; private set; }
+ ///
+ /// Дополнительный цвет (для опциональных элементов)
+ ///
+ public Color AdditionalColor { get; private set; }
+ ///
+ /// Признак (опция) наличия трубы
+ ///
+ public bool Tube { get; private set; }
+ ///
+ /// Признак (опция) наличия топливного бака
+ ///
+ public bool FuelTank { get; private set; }
+ ///
+ /// Признак (опция) наличия паровозной полосы
+ ///
+ public bool LocoLine { get; private set; }
+ ///
+ /// Шаг перемещения поезда
+ ///
+ public double Step => (double)Speed * 100 / Weight;
+ ///
+ /// Инициализация полей объекта-класса Локомотива
+ ///
+ /// Скорость
+ /// Вес автомобиля
+ /// Основной цвет
+ /// Дополнительный цвет
+ /// Признак наличия трубы
+ /// Признак наличия бака
+ /// Признак наличия паровозной полосы
+ public void Init(int speed, double weight, Color bodyColor, Color
+ additionalColor, bool tube, bool fuelTank, bool locoLine)
+ {
+ Speed = speed;
+ Weight = weight;
+ BodyColor = bodyColor;
+ AdditionalColor = additionalColor;
+ Tube = tube;
+ FuelTank = fuelTank;
+ LocoLine = locoLine;
+ }
+
+ }
+}
diff --git a/Laba1Loco/Laba1Loco/FormLocomotive.Designer.cs b/Laba1Loco/Laba1Loco/FormLocomotive.Designer.cs
new file mode 100644
index 0000000..318ed48
--- /dev/null
+++ b/Laba1Loco/Laba1Loco/FormLocomotive.Designer.cs
@@ -0,0 +1,140 @@
+namespace Laba1Loco
+{
+ partial class FormLocomotive
+ {
+ ///
+ /// Обязательная переменная конструктора.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Освободить все используемые ресурсы.
+ ///
+ /// истинно, если управляемый ресурс должен быть удален; иначе ложно.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Код, автоматически созданный конструктором форм Windows
+
+ ///
+ /// Требуемый метод для поддержки конструктора — не изменяйте
+ /// содержимое этого метода с помощью редактора кода.
+ ///
+ private void InitializeComponent()
+ {
+ this.components = new System.ComponentModel.Container();
+ this.pictureBox = new System.Windows.Forms.PictureBox();
+ this.create = new System.Windows.Forms.Button();
+ this.left = new System.Windows.Forms.Button();
+ this.up = new System.Windows.Forms.Button();
+ this.down = new System.Windows.Forms.Button();
+ this.right = new System.Windows.Forms.Button();
+ this.timer1 = new System.Windows.Forms.Timer(this.components);
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit();
+ this.SuspendLayout();
+ //
+ // pictureBox
+ //
+ this.pictureBox.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.pictureBox.Location = new System.Drawing.Point(0, 0);
+ this.pictureBox.Name = "pictureBox";
+ this.pictureBox.Size = new System.Drawing.Size(800, 450);
+ this.pictureBox.TabIndex = 0;
+ this.pictureBox.TabStop = false;
+ //
+ // create
+ //
+ this.create.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.create.Location = new System.Drawing.Point(12, 415);
+ this.create.Name = "create";
+ this.create.Size = new System.Drawing.Size(75, 23);
+ this.create.TabIndex = 1;
+ this.create.Text = "create";
+ this.create.UseVisualStyleBackColor = true;
+ this.create.Click += new System.EventHandler(this.create_Click);
+ //
+ // left
+ //
+ this.left.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.left.Image = global::Laba1Loco.Properties.Resources.arowL340x259;
+ this.left.Location = new System.Drawing.Point(632, 390);
+ this.left.Name = "left";
+ this.left.Size = new System.Drawing.Size(48, 48);
+ this.left.TabIndex = 3;
+ this.left.UseVisualStyleBackColor = true;
+ this.left.Click += new System.EventHandler(this.Click);
+ //
+ // up
+ //
+ this.up.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.up.Image = global::Laba1Loco.Properties.Resources.arowUp340x259;
+ this.up.Location = new System.Drawing.Point(686, 336);
+ this.up.Name = "up";
+ this.up.Size = new System.Drawing.Size(48, 48);
+ this.up.TabIndex = 4;
+ this.up.UseVisualStyleBackColor = true;
+ this.up.Click += new System.EventHandler(this.Click);
+ //
+ // down
+ //
+ this.down.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.down.Image = global::Laba1Loco.Properties.Resources.arowDown340x259;
+ this.down.Location = new System.Drawing.Point(686, 390);
+ this.down.Name = "down";
+ this.down.Size = new System.Drawing.Size(48, 48);
+ this.down.TabIndex = 5;
+ this.down.UseVisualStyleBackColor = true;
+ this.down.Click += new System.EventHandler(this.Click);
+ //
+ // right
+ //
+ this.right.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.right.Image = global::Laba1Loco.Properties.Resources.arowR340x259;
+ this.right.Location = new System.Drawing.Point(740, 390);
+ this.right.Name = "right";
+ this.right.Size = new System.Drawing.Size(48, 48);
+ this.right.TabIndex = 6;
+ this.right.UseVisualStyleBackColor = true;
+ this.right.Click += new System.EventHandler(this.Click);
+ //
+ // timer1
+ //
+ this.timer1.Enabled = true;
+ this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
+ //
+ // FormLocomotive
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(800, 450);
+ this.Controls.Add(this.right);
+ this.Controls.Add(this.down);
+ this.Controls.Add(this.up);
+ this.Controls.Add(this.left);
+ this.Controls.Add(this.create);
+ this.Controls.Add(this.pictureBox);
+ this.Name = "FormLocomotive";
+ this.Text = "Locomotive(moving)";
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.PictureBox pictureBox;
+ private System.Windows.Forms.Button create;
+ private System.Windows.Forms.Button left;
+ private System.Windows.Forms.Button up;
+ private System.Windows.Forms.Button down;
+ private System.Windows.Forms.Button right;
+ private System.Windows.Forms.Timer timer1;
+ }
+}
+
diff --git a/Laba1Loco/Laba1Loco/FormLocomotive.cs b/Laba1Loco/Laba1Loco/FormLocomotive.cs
new file mode 100644
index 0000000..f067f25
--- /dev/null
+++ b/Laba1Loco/Laba1Loco/FormLocomotive.cs
@@ -0,0 +1,97 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace Laba1Loco
+{
+ public partial class FormLocomotive : Form
+ {
+ ///
+ /// Поле-объект для прорисовки объекта
+ ///
+ private DrawingLoco _drawingLoco;
+ ///
+ /// Инициализация формы
+ ///
+ public FormLocomotive()
+ {
+ InitializeComponent();
+ }
+
+ ///
+ /// Метод прорисовки локомотива
+ ///
+ private void Draw()
+ {
+ if (_drawingLoco == null)
+ {
+ return;
+ }
+ Bitmap bmp = new Bitmap(pictureBox.Width, pictureBox.Height);
+ Graphics gr = Graphics.FromImage(bmp);
+ _drawingLoco.DrawTransport(gr);
+ pictureBox.Image = bmp;
+ }
+ ///
+ /// Обработка нажатия кнопки "Создать"
+ ///
+ ///
+ ///
+ private void create_Click(object sender, EventArgs e)
+ {
+ Random random = new Random();
+ _drawingLoco = new DrawingLoco();
+ _drawingLoco.Init(random.Next(100, 300), random.Next(2000, 4000), Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)), Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
+ Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)), pictureBox.Width, pictureBox.Height);
+ _drawingLoco.SetPosition(random.Next(10, 100), random.Next(10, 100));
+ Draw();
+ }
+ ///
+ /// клик движения мышки
+ ///
+ ///
+ ///
+ private void Click(object sender, EventArgs e)
+ {
+ if (_drawingLoco == null)
+ {
+ return;
+ }
+ string name = ((Button)sender)?.Name ?? string.Empty;
+ switch (name)
+ {
+ case "up":
+ _drawingLoco.MoveTransport(Direction.Up);
+ break;
+ case "down":
+ _drawingLoco.MoveTransport(Direction.Down);
+ break;
+ case "left":
+ _drawingLoco.MoveTransport(Direction.Left);
+ break;
+ case "right":
+ _drawingLoco.MoveTransport(Direction.Right);
+ break;
+ }
+ Draw();
+
+ }
+ ///
+ /// таймер для дымка
+ ///
+ ///
+ ///
+ private void timer1_Tick(object sender, EventArgs e)
+ {
+ if (_drawingLoco != null)
+ _drawingLoco.timeTick();
+ Draw();
+ }
+ }
+}
diff --git a/Laba1Loco/Laba1Loco/FormLocomotive.resx b/Laba1Loco/Laba1Loco/FormLocomotive.resx
new file mode 100644
index 0000000..1f666f2
--- /dev/null
+++ b/Laba1Loco/Laba1Loco/FormLocomotive.resx
@@ -0,0 +1,123 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ 17, 17
+
+
\ No newline at end of file
diff --git a/Laba1Loco/Laba1Loco/Laba1Loco.csproj b/Laba1Loco/Laba1Loco/Laba1Loco.csproj
new file mode 100644
index 0000000..68d4bfc
--- /dev/null
+++ b/Laba1Loco/Laba1Loco/Laba1Loco.csproj
@@ -0,0 +1,102 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {9F9C9603-3EF7-403E-A895-04EA0CBC5586}
+ WinExe
+ Laba1Loco
+ Laba1Loco
+ v4.7.2
+ 512
+ true
+ true
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Form
+
+
+ FormLocomotive.cs
+
+
+
+
+ FormLocomotive.cs
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+ Designer
+
+
+ True
+ Resources.resx
+ True
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+ True
+ Settings.settings
+ True
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Laba1Loco/Laba1Loco/Program.cs b/Laba1Loco/Laba1Loco/Program.cs
new file mode 100644
index 0000000..ee9a3f9
--- /dev/null
+++ b/Laba1Loco/Laba1Loco/Program.cs
@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace Laba1Loco
+{
+ internal static class Program
+ {
+ ///
+ /// Главная точка входа для приложения.
+ ///
+ [STAThread]
+ static void Main()
+ {
+ Application.EnableVisualStyles();
+ Application.SetCompatibleTextRenderingDefault(false);
+ Application.Run(new FormLocomotive());
+ }
+ }
+}
diff --git a/Laba1Loco/Laba1Loco/Properties/AssemblyInfo.cs b/Laba1Loco/Laba1Loco/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..3f30958
--- /dev/null
+++ b/Laba1Loco/Laba1Loco/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// Общие сведения об этой сборке предоставляются следующим набором
+// набора атрибутов. Измените значения этих атрибутов для изменения сведений,
+// связанных со сборкой.
+[assembly: AssemblyTitle("Laba1Loco")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Laba1Loco")]
+[assembly: AssemblyCopyright("Copyright © 2023")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми
+// для компонентов COM. Если необходимо обратиться к типу в этой сборке через
+// COM, следует установить атрибут ComVisible в TRUE для этого типа.
+[assembly: ComVisible(false)]
+
+// Следующий GUID служит для идентификации библиотеки типов, если этот проект будет видимым для COM
+[assembly: Guid("9f9c9603-3ef7-403e-a895-04ea0cbc5586")]
+
+// Сведения о версии сборки состоят из указанных ниже четырех значений:
+//
+// Основной номер версии
+// Дополнительный номер версии
+// Номер сборки
+// Редакция
+//
+// Можно задать все значения или принять номера сборки и редакции по умолчанию
+// используя "*", как показано ниже:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Laba1Loco/Laba1Loco/Properties/Resources.Designer.cs b/Laba1Loco/Laba1Loco/Properties/Resources.Designer.cs
new file mode 100644
index 0000000..b2a27ea
--- /dev/null
+++ b/Laba1Loco/Laba1Loco/Properties/Resources.Designer.cs
@@ -0,0 +1,113 @@
+//------------------------------------------------------------------------------
+//
+// Этот код создан программой.
+// Исполняемая версия:4.0.30319.42000
+//
+// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
+// повторной генерации кода.
+//
+//------------------------------------------------------------------------------
+
+namespace Laba1Loco.Properties {
+ using System;
+
+
+ ///
+ /// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
+ ///
+ // Этот класс создан автоматически классом StronglyTypedResourceBuilder
+ // с помощью такого средства, как ResGen или Visual Studio.
+ // Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
+ // с параметром /str или перестройте свой проект VS.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ ///
+ /// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Laba1Loco.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Перезаписывает свойство CurrentUICulture текущего потока для всех
+ /// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap arow340x259 {
+ get {
+ object obj = ResourceManager.GetObject("arow340x259", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap arowDown340x259 {
+ get {
+ object obj = ResourceManager.GetObject("arowDown340x259", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap arowL340x259 {
+ get {
+ object obj = ResourceManager.GetObject("arowL340x259", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap arowR340x259 {
+ get {
+ object obj = ResourceManager.GetObject("arowR340x259", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap arowUp340x259 {
+ get {
+ object obj = ResourceManager.GetObject("arowUp340x259", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+ }
+}
diff --git a/Laba1Loco/Laba1Loco/Properties/Resources.resx b/Laba1Loco/Laba1Loco/Properties/Resources.resx
new file mode 100644
index 0000000..e418b24
--- /dev/null
+++ b/Laba1Loco/Laba1Loco/Properties/Resources.resx
@@ -0,0 +1,136 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+
+ ..\arow340x259.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\arowDown340x259.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\arowL340x259.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\arowR340x259.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\arowUp340x259.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
\ No newline at end of file
diff --git a/Laba1Loco/Laba1Loco/Properties/Settings.Designer.cs b/Laba1Loco/Laba1Loco/Properties/Settings.Designer.cs
new file mode 100644
index 0000000..62a7f82
--- /dev/null
+++ b/Laba1Loco/Laba1Loco/Properties/Settings.Designer.cs
@@ -0,0 +1,30 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace Laba1Loco.Properties
+{
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
+ {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default
+ {
+ get
+ {
+ return defaultInstance;
+ }
+ }
+ }
+}
diff --git a/Laba1Loco/Laba1Loco/Properties/Settings.settings b/Laba1Loco/Laba1Loco/Properties/Settings.settings
new file mode 100644
index 0000000..3964565
--- /dev/null
+++ b/Laba1Loco/Laba1Loco/Properties/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/Laba1Loco/Laba1Loco/arow340x259.png b/Laba1Loco/Laba1Loco/arow340x259.png
new file mode 100644
index 0000000..3d8743b
Binary files /dev/null and b/Laba1Loco/Laba1Loco/arow340x259.png differ
diff --git a/Laba1Loco/Laba1Loco/arowDown340x259.png b/Laba1Loco/Laba1Loco/arowDown340x259.png
new file mode 100644
index 0000000..1aef4dc
Binary files /dev/null and b/Laba1Loco/Laba1Loco/arowDown340x259.png differ
diff --git a/Laba1Loco/Laba1Loco/arowL340x259.png b/Laba1Loco/Laba1Loco/arowL340x259.png
new file mode 100644
index 0000000..a2e6f8b
Binary files /dev/null and b/Laba1Loco/Laba1Loco/arowL340x259.png differ
diff --git a/Laba1Loco/Laba1Loco/arowR340x259.png b/Laba1Loco/Laba1Loco/arowR340x259.png
new file mode 100644
index 0000000..464963a
Binary files /dev/null and b/Laba1Loco/Laba1Loco/arowR340x259.png differ
diff --git a/Laba1Loco/Laba1Loco/arowUp340x259.png b/Laba1Loco/Laba1Loco/arowUp340x259.png
new file mode 100644
index 0000000..3d8743b
Binary files /dev/null and b/Laba1Loco/Laba1Loco/arowUp340x259.png differ