diff --git a/Lab/Arrows/Down.png b/Lab/Arrows/Down.png
new file mode 100644
index 0000000..e277d3a
Binary files /dev/null and b/Lab/Arrows/Down.png differ
diff --git a/Lab/Arrows/Left.png b/Lab/Arrows/Left.png
new file mode 100644
index 0000000..e36b325
Binary files /dev/null and b/Lab/Arrows/Left.png differ
diff --git a/Lab/Arrows/Right.png b/Lab/Arrows/Right.png
new file mode 100644
index 0000000..654bcb7
Binary files /dev/null and b/Lab/Arrows/Right.png differ
diff --git a/Lab/Arrows/Up.png b/Lab/Arrows/Up.png
new file mode 100644
index 0000000..1654c3e
Binary files /dev/null and b/Lab/Arrows/Up.png differ
diff --git a/Lab/BaseCar.cs b/Lab/BaseCar.cs
new file mode 100644
index 0000000..3445b72
--- /dev/null
+++ b/Lab/BaseCar.cs
@@ -0,0 +1,30 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Lab
+{
+ public class BaseCar
+ {
+ 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 BodyKit { get; private set; }
+ public bool Wing { get; private set; }
+ public bool SportLine { get; private set; }
+ public double Step => (double)Speed * 100 / Weight;
+ public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool bodyKit, bool wing, bool sportLine)
+ {
+ Speed = speed;
+ Weight = weight;
+ BodyColor = bodyColor;
+ AdditionalColor = additionalColor;
+ BodyKit = bodyKit;
+ Wing = wing;
+ SportLine = sportLine;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Lab/Direction.cs b/Lab/Direction.cs
new file mode 100644
index 0000000..fd15dc2
--- /dev/null
+++ b/Lab/Direction.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Lab
+{
+ public enum Direction
+ {
+ Up = 1,
+ Down = 2,
+ Left = 3,
+ Right = 4
+ }
+}
\ No newline at end of file
diff --git a/Lab/DrawGasolineTanker.cs b/Lab/DrawGasolineTanker.cs
new file mode 100644
index 0000000..0fd98ac
--- /dev/null
+++ b/Lab/DrawGasolineTanker.cs
@@ -0,0 +1,112 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Lab
+{
+ public class DrawGasolineTanker
+ {
+ public BaseCar? GasolineTanker { get; private set; }
+ private int _pictureWidth;
+ private int _pictureHeight;
+ private int _startPosX;
+ private int _startPosY;
+ private readonly int _carWidth = 100;
+ private readonly int _carHeight = 80;
+
+ public bool Init(int speed, double weight, Color bodyColor, Color additionalColor, bool bodyKit, bool wing, bool sportLine, int width, int height)
+ {
+ _pictureHeight = height;
+ _pictureWidth = width;
+ GasolineTanker = new BaseCar();
+ GasolineTanker.Init(speed, weight, bodyColor, additionalColor, bodyKit, wing, sportLine);
+
+
+ return true;
+ }
+
+
+ public void SetPosition(int x, int y)
+ {
+ _startPosX = x;
+ _startPosY = y;
+ }
+
+ public void MoveTransport(Direction direction)
+ {
+ if (GasolineTanker == null)
+ return;
+ switch (direction)
+ {
+ case Direction.Left:
+ {
+ if (_startPosX - GasolineTanker.Step > 0)
+ {
+ _startPosX -= (int)GasolineTanker.Step;
+ }
+ }
+ break;
+ case Direction.Up:
+ {
+ if (_startPosY - GasolineTanker.Step > 0)
+ {
+ _startPosY -= (int)GasolineTanker.Step;
+ }
+ }
+ break;
+ case Direction.Right:
+ {
+ if (_startPosX + _carWidth + GasolineTanker.Step < _pictureWidth)
+ {
+ _startPosX += (int)GasolineTanker.Step;
+ }
+ }
+ break;
+ case Direction.Down:
+ {
+ if (_startPosY + GasolineTanker.Step + _carHeight < _pictureHeight)
+ {
+ _startPosY += (int)GasolineTanker.Step;
+ }
+ }
+ break;
+ }
+ }
+
+ public void DrawTransport(Graphics g)
+ {
+ if (GasolineTanker == null)
+ return;
+ Pen pen = new(GasolineTanker.BodyColor, 2);
+ Brush brush = new SolidBrush(GasolineTanker.BodyColor);
+ if (GasolineTanker.BodyKit)
+ {
+ Brush bodyBrush = new SolidBrush(GasolineTanker.AdditionalColor);
+ g.FillEllipse(bodyBrush, 10 + _startPosX, 10 + _startPosY, 70, 30);
+ }
+ // Отрисовка корпуса
+ g.FillRectangle(brush, 10 + _startPosX, 40 + _startPosY, 90, 20);
+ g.FillRectangle(brush, 80 + _startPosX, 10 + _startPosY, 20, 40);
+ // Отрисовка колесиков
+ g.FillEllipse(brush, 10 + _startPosX, 60 + _startPosY, 20, 20);
+ g.FillEllipse(brush, 30 + _startPosX, 60 + _startPosY, 20, 20);
+ g.FillEllipse(brush, 80 + _startPosX, 60 + _startPosY, 20, 20);
+ if (GasolineTanker.SportLine)
+ {
+ Brush lineBrush = new SolidBrush(GasolineTanker.AdditionalColor);
+ g.FillRectangle(lineBrush, 15 + _startPosX, 45 + _startPosY, 20, 5);
+ g.FillRectangle(lineBrush, 40 + _startPosX, 45 + _startPosY, 20, 5);
+ g.FillRectangle(lineBrush, 65 + _startPosX, 45 + _startPosY, 20, 5);
+ }
+
+ if (GasolineTanker.Wing)
+ {
+ Brush lightBrush = new SolidBrush(GasolineTanker.AdditionalColor);
+ g.FillRectangle(lightBrush, 87 + _startPosX, 5 + _startPosY, 5, 5);
+ }
+
+ }
+ }
+}
diff --git a/Lab/Frame.Designer.cs b/Lab/Frame.Designer.cs
new file mode 100644
index 0000000..6ed856b
--- /dev/null
+++ b/Lab/Frame.Designer.cs
@@ -0,0 +1,134 @@
+namespace Lab
+{
+ partial class Frame
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ DrawCar = new PictureBox();
+ CreateCarButton = new Button();
+ Up = new Button();
+ Left = new Button();
+ Down = new Button();
+ Right = new Button();
+ ((System.ComponentModel.ISupportInitialize)DrawCar).BeginInit();
+ SuspendLayout();
+ //
+ // DrawCar
+ //
+ DrawCar.Dock = DockStyle.Fill;
+ DrawCar.Location = new Point(0, 0);
+ DrawCar.Name = "DrawCar";
+ DrawCar.Size = new Size(882, 553);
+ DrawCar.TabIndex = 1;
+ DrawCar.TabStop = false;
+ //
+ // CreateCarButton
+ //
+ CreateCarButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
+ CreateCarButton.Location = new Point(12, 512);
+ CreateCarButton.Name = "CreateCarButton";
+ CreateCarButton.Size = new Size(94, 29);
+ CreateCarButton.TabIndex = 2;
+ CreateCarButton.Text = "Создать";
+ CreateCarButton.UseVisualStyleBackColor = true;
+ CreateCarButton.Click += CreateCarButton_Click;
+ //
+ // Up
+ //
+ Up.BackgroundImage = Properties.Resources.Up;
+ Up.BackgroundImageLayout = ImageLayout.Zoom;
+ Up.Location = new Point(804, 476);
+ Up.Name = "Up";
+ Up.Size = new Size(30, 30);
+ Up.TabIndex = 3;
+ Up.Text = "↑";
+ Up.UseVisualStyleBackColor = true;
+ Up.Click += ButtonMove_Click;
+ //
+ // Left
+ //
+ Left.BackgroundImage = Properties.Resources.Left;
+ Left.BackgroundImageLayout = ImageLayout.Zoom;
+ Left.Location = new Point(768, 512);
+ Left.Name = "Left";
+ Left.Size = new Size(30, 30);
+ Left.TabIndex = 4;
+ Left.Text = "←";
+ Left.UseVisualStyleBackColor = true;
+ Left.Click += ButtonMove_Click;
+ //
+ // Down
+ //
+ Down.BackgroundImage = Properties.Resources.Down;
+ Down.BackgroundImageLayout = ImageLayout.Zoom;
+ Down.Location = new Point(804, 512);
+ Down.Name = "Down";
+ Down.Size = new Size(30, 30);
+ Down.TabIndex = 5;
+ Down.Text = "↓";
+ Down.UseVisualStyleBackColor = true;
+ Down.Click += ButtonMove_Click;
+ //
+ // Right
+ //
+ Right.BackgroundImage = Properties.Resources.Right;
+ Right.BackgroundImageLayout = ImageLayout.Zoom;
+ Right.Location = new Point(840, 512);
+ Right.Name = "Right";
+ Right.Size = new Size(30, 30);
+ Right.TabIndex = 6;
+ Right.Text = "→";
+ Right.UseVisualStyleBackColor = true;
+ Right.Click += ButtonMove_Click;
+ //
+ // Frame
+ //
+ AutoScaleDimensions = new SizeF(8F, 20F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(882, 553);
+ Controls.Add(Right);
+ Controls.Add(Down);
+ Controls.Add(Left);
+ Controls.Add(Up);
+ Controls.Add(CreateCarButton);
+ Controls.Add(DrawCar);
+ Name = "Frame";
+ StartPosition = FormStartPosition.CenterScreen;
+ Text = "GasolineTanker";
+ ((System.ComponentModel.ISupportInitialize)DrawCar).EndInit();
+ ResumeLayout(false);
+ }
+
+ #endregion
+ private PictureBox DrawCar;
+ private Button CreateCarButton;
+ private Button Up;
+ private Button Left;
+ private Button Down;
+ private Button Right;
+ }
+}
\ No newline at end of file
diff --git a/Lab/Frame.cs b/Lab/Frame.cs
new file mode 100644
index 0000000..5e4cb22
--- /dev/null
+++ b/Lab/Frame.cs
@@ -0,0 +1,52 @@
+namespace Lab
+{
+ public partial class Frame : Form
+ {
+ private DrawGasolineTanker? _drawingSportCar;
+ public Frame()
+ {
+ InitializeComponent();
+ }
+
+ private void Draw()
+ {
+ if (_drawingSportCar == null)
+ return;
+ Bitmap bitmap = new(DrawCar.Width, DrawCar.Height);
+ Graphics g = Graphics.FromImage(bitmap);
+ _drawingSportCar.DrawTransport(g);
+ DrawCar.Image = bitmap;
+ }
+ private void CreateCarButton_Click(object sender, EventArgs e)
+ {
+ Random rnd = new();
+ _drawingSportCar = new();
+ _drawingSportCar.Init(rnd.Next(100, 200), rnd.Next(2000, 4000),
+ Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)),
+ Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)),
+ Convert.ToBoolean(rnd.Next(0, 2)), Convert.ToBoolean(rnd.Next(0, 2)), Convert.ToBoolean(rnd.Next(0, 2)),
+ DrawCar.Width, DrawCar.Height);
+ _drawingSportCar.SetPosition(rnd.Next(10, 100), rnd.Next(10, 100));
+ Draw();
+ }
+
+ private void ButtonMove_Click(object sender, EventArgs e)
+ {
+ if (_drawingSportCar == null)
+ return;
+ string name = ((Button)sender)?.Name ?? string.Empty;
+ switch (name)
+ {
+ case "Up":
+ _drawingSportCar.MoveTransport(Direction.Up); break;
+ case "Down":
+ _drawingSportCar.MoveTransport(Direction.Down); break;
+ case "Left":
+ _drawingSportCar.MoveTransport(Direction.Left); break;
+ case "Right":
+ _drawingSportCar.MoveTransport(Direction.Right); break;
+ }
+ Draw();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Lab/Frame.resx b/Lab/Frame.resx
new file mode 100644
index 0000000..af32865
--- /dev/null
+++ b/Lab/Frame.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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
+
+
\ No newline at end of file
diff --git a/Lab/Lab.csproj b/Lab/Lab.csproj
new file mode 100644
index 0000000..13ee123
--- /dev/null
+++ b/Lab/Lab.csproj
@@ -0,0 +1,26 @@
+
+
+
+ WinExe
+ net6.0-windows
+ enable
+ true
+ enable
+
+
+
+
+ True
+ True
+ Resources.resx
+
+
+
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+
+
\ No newline at end of file
diff --git a/Lab/Lab.sln b/Lab/Lab.sln
new file mode 100644
index 0000000..3196015
--- /dev/null
+++ b/Lab/Lab.sln
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.7.34009.444
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lab", "Lab.csproj", "{7EA8E822-6F7A-476A-9281-CBCB69B9CAD8}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {7EA8E822-6F7A-476A-9281-CBCB69B9CAD8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {7EA8E822-6F7A-476A-9281-CBCB69B9CAD8}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {7EA8E822-6F7A-476A-9281-CBCB69B9CAD8}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {7EA8E822-6F7A-476A-9281-CBCB69B9CAD8}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {01673CC0-0038-41A0-BBEB-C63858590694}
+ EndGlobalSection
+EndGlobal
diff --git a/Lab/Program.cs b/Lab/Program.cs
new file mode 100644
index 0000000..dfdc54f
--- /dev/null
+++ b/Lab/Program.cs
@@ -0,0 +1,17 @@
+namespace Lab
+{
+ 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 Frame());
+ }
+ }
+}
\ No newline at end of file
diff --git a/Lab/Properties/Resources.Designer.cs b/Lab/Properties/Resources.Designer.cs
new file mode 100644
index 0000000..231fd99
--- /dev/null
+++ b/Lab/Properties/Resources.Designer.cs
@@ -0,0 +1,103 @@
+//------------------------------------------------------------------------------
+//
+// Этот код создан программой.
+// Исполняемая версия:4.0.30319.42000
+//
+// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
+// повторной генерации кода.
+//
+//------------------------------------------------------------------------------
+
+namespace Lab.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("Lab.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 Down {
+ get {
+ object obj = ResourceManager.GetObject("Down", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap Left {
+ get {
+ object obj = ResourceManager.GetObject("Left", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap Right {
+ get {
+ object obj = ResourceManager.GetObject("Right", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap Up {
+ get {
+ object obj = ResourceManager.GetObject("Up", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+ }
+}
diff --git a/Lab/Properties/Resources.resx b/Lab/Properties/Resources.resx
new file mode 100644
index 0000000..af3af44
--- /dev/null
+++ b/Lab/Properties/Resources.resx
@@ -0,0 +1,133 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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
+
+
+
+ ..\Arrows\Down.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Arrows\Left.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Arrows\Right.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Arrows\Up.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
\ No newline at end of file