From 791b1a2491ed98eb1d1bd76e98b2789e636a95f5 Mon Sep 17 00:00:00 2001 From: Saanechkaa Date: Wed, 12 Oct 2022 16:50:24 +0400 Subject: [PATCH 1/4] Lab2 ready --- RoadTrain/RoadTrain/AbstractMap.cs | 120 ++++++++++ RoadTrain/RoadTrain/Direction.cs | 1 + .../RoadTrain/DrawningObjectRoadTrain.cs | 34 +++ RoadTrain/RoadTrain/DrawningRoadTrain.cs | 79 ++++--- .../RoadTrain/DrawningSweeperRoadTrain.cs | 81 +++++++ RoadTrain/RoadTrain/EntityRoadTrain.cs | 3 +- RoadTrain/RoadTrain/EntitySweeperRoadTrain.cs | 44 ++++ RoadTrain/RoadTrain/FormMap.Designer.cs | 208 ++++++++++++++++++ RoadTrain/RoadTrain/FormMap.cs | 108 +++++++++ RoadTrain/RoadTrain/FormMap.resx | 63 ++++++ RoadTrain/RoadTrain/FormRoadTrain.Designer.cs | 28 +-- RoadTrain/RoadTrain/FormRoadTrain.cs | 22 +- RoadTrain/RoadTrain/FormRoadTrain.resx | 2 +- RoadTrain/RoadTrain/IDrawningObject.cs | 40 ++++ RoadTrain/RoadTrain/Program.cs | 2 +- RoadTrain/RoadTrain/RoadMap.cs | 57 +++++ RoadTrain/RoadTrain/SimpleMap.cs | 57 +++++ 17 files changed, 889 insertions(+), 60 deletions(-) create mode 100644 RoadTrain/RoadTrain/AbstractMap.cs create mode 100644 RoadTrain/RoadTrain/DrawningObjectRoadTrain.cs create mode 100644 RoadTrain/RoadTrain/DrawningSweeperRoadTrain.cs create mode 100644 RoadTrain/RoadTrain/EntitySweeperRoadTrain.cs create mode 100644 RoadTrain/RoadTrain/FormMap.Designer.cs create mode 100644 RoadTrain/RoadTrain/FormMap.cs create mode 100644 RoadTrain/RoadTrain/FormMap.resx create mode 100644 RoadTrain/RoadTrain/IDrawningObject.cs create mode 100644 RoadTrain/RoadTrain/RoadMap.cs create mode 100644 RoadTrain/RoadTrain/SimpleMap.cs diff --git a/RoadTrain/RoadTrain/AbstractMap.cs b/RoadTrain/RoadTrain/AbstractMap.cs new file mode 100644 index 0000000..b4b2a83 --- /dev/null +++ b/RoadTrain/RoadTrain/AbstractMap.cs @@ -0,0 +1,120 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection.Metadata.Ecma335; +using System.Text; +using System.Threading.Tasks; + +namespace RoadTrain +{ + internal abstract class AbstractMap + { + private IDrawningObject _drawningObject = null; + protected int[,] _map = null; + protected int _width; + protected int _height; + protected float _size_x; + protected float _size_y; + protected readonly Random _random = new(); + protected readonly int _freeRoad = 0; + protected readonly int _barrier = 1; + public Bitmap CreateMap(int width, int height, IDrawningObject drawningObject) + { + _width = width; + _height = height; + _drawningObject = drawningObject; + GenerateMap(); + while (!SetObjectOnMap()) + { + GenerateMap(); + } + return DrawMapWithObject(); + } + public bool CheckBarrier(float Left, float Right, float Top, float Bottom) + { + int startX = (int)(Left / _size_x); + int startY = (int)(Right / _size_y); + int endX = (int)(Top / _size_x); + int endY = (int)(Bottom / _size_y); + for (int i = startX; i<= endX; i++) + { + for (int j = startY; j<= endY; j++) + { + if (_map[i, j] == _barrier) + { + return true; + } + } + } + return false; + } + public Bitmap MoveObject(Direction direction) + { + _drawningObject.MoveObject(direction); + (float Left, float Top, float Right, float Bottom) = _drawningObject.GetCurrentPosition(); + if (CheckBarrier(Left, Top, Right, Bottom)) + { + _drawningObject.MoveObject(MoveObjectNew(direction)); + } + return DrawMapWithObject(); + } + private Direction MoveObjectNew(Direction direction) + { + switch (direction) + { + case Direction.Up: + return Direction.Down; + case Direction.Down: + return Direction.Up; + case Direction.Left: + return Direction.Right; + case Direction.Right: + return Direction.Left; + } + return Direction.None; + } + + private bool SetObjectOnMap() + { + if (_drawningObject == null || _map == null) + { + return false; + } + int x = _random.Next(0, 10); + int y = _random.Next(0, 10); + _drawningObject.SetObject(x, y, _width, _height); + (float Left, float Top, float Right, float Bottom) = _drawningObject.GetCurrentPosition(); + if (!CheckBarrier(Left, Top, Right, Bottom)) return true; + return false; + } + private Bitmap DrawMapWithObject() + { + Bitmap bmp = new(_width, _height); + if (_drawningObject == null || _map == null) + { + return bmp; + } + Graphics gr = Graphics.FromImage(bmp); + for (int i = 0; i < _map.GetLength(0); ++i) + { + for (int j = 0; j < _map.GetLength(1); ++j) + { + if (_map[i, j] == _freeRoad) + { + DrawRoadPart(gr, i, j); + } + else if (_map[i, j] == _barrier) + { + DrawBarrierPart(gr, i, j); + } + } + } + _drawningObject.DrawningObject(gr); + return bmp; + } + protected abstract void GenerateMap(); + protected abstract void DrawRoadPart(Graphics g, int i, int j); + protected abstract void DrawBarrierPart(Graphics g, int i, int j); + + } +} diff --git a/RoadTrain/RoadTrain/Direction.cs b/RoadTrain/RoadTrain/Direction.cs index 6f99de7..836102e 100644 --- a/RoadTrain/RoadTrain/Direction.cs +++ b/RoadTrain/RoadTrain/Direction.cs @@ -8,6 +8,7 @@ namespace RoadTrain { internal enum Direction { + None = 0, Up = 1, Down = 2, Left = 3, diff --git a/RoadTrain/RoadTrain/DrawningObjectRoadTrain.cs b/RoadTrain/RoadTrain/DrawningObjectRoadTrain.cs new file mode 100644 index 0000000..96ebb18 --- /dev/null +++ b/RoadTrain/RoadTrain/DrawningObjectRoadTrain.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace RoadTrain +{ + internal class DrawningObjectRoadTrain : IDrawningObject + { + private DrawningRoadTrain _roadTrain = null; + public DrawningObjectRoadTrain(DrawningRoadTrain roadTrain) + { + _roadTrain = roadTrain; + } + public float Step => _roadTrain?.RoadTrain?.Step ?? 0; + public (float Left, float Top, float Right, float Bottom) GetCurrentPosition() + { + return _roadTrain?.GetCurrentPosition() ?? default; + } + public void MoveObject(Direction direction) + { + _roadTrain?.MoveTransport(direction); + } + public void SetObject(int x, int y, int width, int height) + { + _roadTrain.SetPosition(x, y, width, height); + } + public void DrawningObject(Graphics g) + { + _roadTrain.DrawTransport(g); + } + } +} diff --git a/RoadTrain/RoadTrain/DrawningRoadTrain.cs b/RoadTrain/RoadTrain/DrawningRoadTrain.cs index f242cef..93021b2 100644 --- a/RoadTrain/RoadTrain/DrawningRoadTrain.cs +++ b/RoadTrain/RoadTrain/DrawningRoadTrain.cs @@ -11,15 +11,15 @@ namespace RoadTrain /// /// Класс-сущность /// - public EntityRoadTrain RoadTrain { private set; get; } + public EntityRoadTrain RoadTrain { protected set; get; } /// /// Левая координата отрисовки грузовика /// - private float _startPosX; + protected float _startPosX; /// /// Верхняя кооридната отрисовки грузовика /// - private float _startPosY; + protected float _startPosY; /// /// Ширина окна отрисовки /// @@ -35,17 +35,10 @@ namespace RoadTrain /// /// Высота отрисовки грузовика /// - private readonly int _RoadTrainHeight = 150; - /// - /// Инициализация свойств - /// - /// Скорость - /// Вес грузовика - /// Цвет кузова - public void Init(int speed, float weight, Color bodyColor) + private readonly int _RoadTrainHeight = 155; + public DrawningRoadTrain(int speed, float weight, Color bodyColor) { - RoadTrain = new EntityRoadTrain(); - RoadTrain.Init(speed, weight, bodyColor); + RoadTrain = new EntityRoadTrain(speed, weight, bodyColor); } /// /// Установка позиции грузовика @@ -110,36 +103,46 @@ namespace RoadTrain } } /// + /// Инициализация свойств + /// + /// Скорость + /// Вес грузовика + /// Цвет кузова + /// Ширина отрисовки грузовика + /// Высота отрисовки грузовика + protected DrawningRoadTrain(int speed, float weight, Color bodyColor, int RoadTrainWidth, int RoadTrainHeight) : + this(speed, weight, bodyColor) + { + _RoadTrainWidth = RoadTrainWidth; + _RoadTrainHeight = RoadTrainHeight; + } + /// /// Отрисовка грузовика /// /// - public void DrawTransport(Graphics g) + public virtual void DrawTransport(Graphics g) { - Brush mainColor = new SolidBrush(RoadTrain?.BodyColor ?? Color.Black); Brush brBlack = new SolidBrush(Color.Black); Brush brGray = new SolidBrush(Color.Gray); Brush brBlue = new SolidBrush(Color.Blue); - Brush brYellow = new SolidBrush(Color.Yellow); - Brush brBrown = new SolidBrush(Color.Brown); Pen pen = new Pen(Color.Black); - - g.FillRectangle(brBlack, _startPosX, _startPosY + 90, 185, 20); //Платформа - g.DrawRectangle(pen, _startPosX, _startPosY + 90, 185, 20); - g.FillRectangle(mainColor, _startPosX + 110, _startPosY, 75, 90);//Кабина - g.DrawRectangle(pen, _startPosX + 110, _startPosY, 75, 90); - g.FillRectangle(brBlue, _startPosX + 150, _startPosY + 20, 30, 50);//Окно - g.DrawRectangle(pen, _startPosX + 150, _startPosY + 20, 30, 50); - g.FillEllipse(brGray, _startPosX, _startPosY + 110, 40, 40);//Колёса - g.DrawEllipse(pen, _startPosX, _startPosY + 110, 40, 40); - g.FillEllipse(brBlack, _startPosX + 5, _startPosY + 115, 30, 30); - g.FillEllipse(brGray, _startPosX + 45, _startPosY + 110, 40, 40); - g.DrawEllipse(pen, _startPosX + 45, _startPosY + 110, 40, 40); - g.FillEllipse(brBlack, _startPosX + 50, _startPosY + 115, 30, 30); - g.FillEllipse(brGray, _startPosX + 140, _startPosY + 110, 40, 40); - g.DrawEllipse(pen, _startPosX + 140, _startPosY + 110, 40, 40); - g.FillEllipse(brBlack, _startPosX + 145, _startPosY + 115, 30, 30); - + g.FillRectangle(brBlack, _startPosX+15, _startPosY + 100, 185, 20); //Платформа + g.DrawRectangle(pen, _startPosX+15, _startPosY + 100, 185, 20); + g.FillRectangle(mainColor, _startPosX + 125, _startPosY+10, 75, 90);//Кабина + g.DrawRectangle(pen, _startPosX + 125, _startPosY+10,75, 90); + g.FillRectangle(brBlue, _startPosX + 165, _startPosY + 30, 30, 50);//Окно + g.DrawRectangle(pen, _startPosX + 165, _startPosY + 30, 30, 50); + g.FillEllipse(brGray, _startPosX+15, _startPosY + 120, 40, 40);//Колёса + g.DrawEllipse(pen, _startPosX+15, _startPosY + 120, 40, 40); + g.FillEllipse(brBlack, _startPosX + 20, _startPosY + 125, 30, 30); + g.FillEllipse(brGray, _startPosX + 60, _startPosY + 120, 40, 40); + g.DrawEllipse(pen, _startPosX + 60, _startPosY + 120, 40, 40); + g.FillEllipse(brBlack, _startPosX + 65, _startPosY + 125, 30, 30); + g.FillEllipse(brGray, _startPosX + 155, _startPosY + 120, 40, 40); + g.DrawEllipse(pen, _startPosX + 155, _startPosY + 120, 40, 40); + g.FillEllipse(brBlack, _startPosX + 160, _startPosY + 125, 30, 30); + } /// /// Смена границ формы отрисовки @@ -165,5 +168,13 @@ namespace RoadTrain _startPosY = _pictureHeight.Value - _RoadTrainHeight; } } + /// + /// Получение текущей позиции объекта + /// + /// + public (float Left, float Top, float Right, float Bottom) GetCurrentPosition() + { + return (_startPosX, _startPosY, _startPosX + _RoadTrainWidth, _startPosY + _RoadTrainHeight); + } } } diff --git a/RoadTrain/RoadTrain/DrawningSweeperRoadTrain.cs b/RoadTrain/RoadTrain/DrawningSweeperRoadTrain.cs new file mode 100644 index 0000000..91a954f --- /dev/null +++ b/RoadTrain/RoadTrain/DrawningSweeperRoadTrain.cs @@ -0,0 +1,81 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net.Sockets; +using System.Text; +using System.Threading.Tasks; + +namespace RoadTrain +{ + /// + /// Класс, отвечающий за прорисовку и перемещение объекта-сущности + /// + internal class DrawningSweeperRoadTrain : DrawningRoadTrain + { + /// + /// Инициализация свойств + /// + /// Скорость + /// Вес грузовика + /// Цвет кузова + /// Дополнительный цвет + /// Признак наличия водяного бака + /// Признак наличия подметальной щётки + public DrawningSweeperRoadTrain(int speed, float weight, Color bodyColor, Color dopColor, bool waterTank, bool sweepingBush) : + base(speed, weight, bodyColor, 285, 170) + { + RoadTrain = new EntitySweeperRoadTrain(speed, weight, bodyColor, dopColor, waterTank, + sweepingBush); + } + public override void DrawTransport(Graphics g) + { + if (RoadTrain is not EntitySweeperRoadTrain SweeperRoadTrain) + { + return; + } + Pen pen = new(Color.Black); + Brush dopBrush = new SolidBrush(SweeperRoadTrain.DopColor); + Brush YellowBrush = new SolidBrush(Color.Yellow); + if (SweeperRoadTrain.WaterTank) + { + g.FillRectangle(dopBrush, _startPosX + 20, _startPosY+20, 105, 80); + g.DrawRectangle(pen, _startPosX + 20, _startPosY+20, 105, 80); + } + base.DrawTransport(g); + if (SweeperRoadTrain.SweepingBush) + { + PointF[] handle = { + new PointF(_startPosX + 200, _startPosY + 100), + new PointF(_startPosX +245, _startPosY + 105), + new PointF(_startPosX +265, _startPosY + 130), + new PointF(_startPosX +240, _startPosY + 130), + new PointF(_startPosX +235, _startPosY + 120), + new PointF(_startPosX +200, _startPosY + 120), + new PointF(_startPosX +200, _startPosY + 105) + }; + g.FillPolygon(dopBrush, handle); + g.DrawPolygon(pen, handle); + + PointF[] holder = { + new PointF(_startPosX + 235, _startPosY + 130), + new PointF(_startPosX +285, _startPosY + 130), + new PointF(_startPosX +290, _startPosY + 140), + new PointF(_startPosX +225, _startPosY + 140), + new PointF(_startPosX +235, _startPosY + 130) + }; + g.FillPolygon(dopBrush, holder); + g.DrawPolygon(pen, holder); + PointF[] sweep = { + new PointF(_startPosX + 225, _startPosY + 140), + new PointF(_startPosX +290, _startPosY + 140), + new PointF(_startPosX +300, _startPosY + 160), + new PointF(_startPosX +215, _startPosY + 160), + new PointF(_startPosX +225, _startPosY + 140) + }; + g.FillPolygon(YellowBrush, sweep); + g.DrawPolygon(pen, sweep); + } + } + + } +} diff --git a/RoadTrain/RoadTrain/EntityRoadTrain.cs b/RoadTrain/RoadTrain/EntityRoadTrain.cs index 0824905..b19f1fb 100644 --- a/RoadTrain/RoadTrain/EntityRoadTrain.cs +++ b/RoadTrain/RoadTrain/EntityRoadTrain.cs @@ -31,12 +31,13 @@ namespace RoadTrain /// /// /// - public void Init(int speed, float weight, Color bodyColor) + public EntityRoadTrain(int speed, float weight, Color bodyColor) { Random rnd = new(); Speed = speed <= 0 ? rnd.Next(50, 150) : speed; Weight = weight <= 0 ? rnd.Next(40, 70) : weight; BodyColor = bodyColor; } + } } diff --git a/RoadTrain/RoadTrain/EntitySweeperRoadTrain.cs b/RoadTrain/RoadTrain/EntitySweeperRoadTrain.cs new file mode 100644 index 0000000..05140ce --- /dev/null +++ b/RoadTrain/RoadTrain/EntitySweeperRoadTrain.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace RoadTrain +{ + /// + /// Класс-сущность "Подметально-уборочная машина" + /// + internal class EntitySweeperRoadTrain : EntityRoadTrain + { + /// + /// Дополнительный цвет + /// + public Color DopColor { get; private set; } + /// + /// Признак наличия бака под воду + /// + public bool WaterTank { get; private set; } + /// + /// Признак наличия подметательной щётки + /// + public bool SweepingBush { get; private set; } + /// + /// Инициализация свойств + /// + /// Скорость + /// Вес грузовика + /// Цвет кузова + /// Дополнительный цвет + /// Признак водяного бака + /// Признак подметательной щётки + public EntitySweeperRoadTrain(int speed, float weight, Color bodyColor, Color + dopColor, bool waterTank, bool sweepingBush) : + base(speed, weight, bodyColor) + { + DopColor = dopColor; + WaterTank = waterTank; + SweepingBush = sweepingBush; + } + } +} diff --git a/RoadTrain/RoadTrain/FormMap.Designer.cs b/RoadTrain/RoadTrain/FormMap.Designer.cs new file mode 100644 index 0000000..06a7bab --- /dev/null +++ b/RoadTrain/RoadTrain/FormMap.Designer.cs @@ -0,0 +1,208 @@ +namespace RoadTrain +{ + partial class FormMap + { + /// + /// 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() + { + this.statusStripRoadTrain = new System.Windows.Forms.StatusStrip(); + this.toolStripStatusLabelSpeed = new System.Windows.Forms.ToolStripStatusLabel(); + this.toolStripStatusLabelWeight = new System.Windows.Forms.ToolStripStatusLabel(); + this.toolStripStatusLabelBodyColor = new System.Windows.Forms.ToolStripStatusLabel(); + this.pictureBoxRoadTrain = new System.Windows.Forms.PictureBox(); + this.buttonCreate = new System.Windows.Forms.Button(); + this.buttonLeft = new System.Windows.Forms.Button(); + this.buttonDown = new System.Windows.Forms.Button(); + this.buttonUp = new System.Windows.Forms.Button(); + this.buttonRight = new System.Windows.Forms.Button(); + this.comboBoxSelectorMap = new System.Windows.Forms.ComboBox(); + this.buttonCreateModif = new System.Windows.Forms.Button(); + this.statusStripRoadTrain.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBoxRoadTrain)).BeginInit(); + this.SuspendLayout(); + // + // statusStripRoadTrain + // + this.statusStripRoadTrain.ImageScalingSize = new System.Drawing.Size(20, 20); + this.statusStripRoadTrain.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripStatusLabelSpeed, + this.toolStripStatusLabelWeight, + this.toolStripStatusLabelBodyColor}); + this.statusStripRoadTrain.Location = new System.Drawing.Point(0, 427); + this.statusStripRoadTrain.Name = "statusStripRoadTrain"; + this.statusStripRoadTrain.Size = new System.Drawing.Size(882, 26); + this.statusStripRoadTrain.TabIndex = 0; + this.statusStripRoadTrain.Text = "statusStrip1"; + // + // toolStripStatusLabelSpeed + // + this.toolStripStatusLabelSpeed.Name = "toolStripStatusLabelSpeed"; + this.toolStripStatusLabelSpeed.Size = new System.Drawing.Size(76, 20); + this.toolStripStatusLabelSpeed.Text = "Скорость:"; + // + // toolStripStatusLabelWeight + // + this.toolStripStatusLabelWeight.Name = "toolStripStatusLabelWeight"; + this.toolStripStatusLabelWeight.Size = new System.Drawing.Size(36, 20); + this.toolStripStatusLabelWeight.Text = "Вес:"; + // + // toolStripStatusLabelBodyColor + // + this.toolStripStatusLabelBodyColor.Name = "toolStripStatusLabelBodyColor"; + this.toolStripStatusLabelBodyColor.Size = new System.Drawing.Size(42, 20); + this.toolStripStatusLabelBodyColor.Text = "Цвет"; + // + // pictureBoxRoadTrain + // + this.pictureBoxRoadTrain.Dock = System.Windows.Forms.DockStyle.Fill; + this.pictureBoxRoadTrain.Location = new System.Drawing.Point(0, 0); + this.pictureBoxRoadTrain.Name = "pictureBoxRoadTrain"; + this.pictureBoxRoadTrain.Size = new System.Drawing.Size(882, 427); + this.pictureBoxRoadTrain.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; + this.pictureBoxRoadTrain.TabIndex = 1; + this.pictureBoxRoadTrain.TabStop = false; + // + // buttonCreate + // + this.buttonCreate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.buttonCreate.Location = new System.Drawing.Point(23, 383); + this.buttonCreate.Name = "buttonCreate"; + this.buttonCreate.Size = new System.Drawing.Size(94, 29); + this.buttonCreate.TabIndex = 3; + this.buttonCreate.Text = "Создать"; + this.buttonCreate.UseVisualStyleBackColor = true; + this.buttonCreate.Click += new System.EventHandler(this.ButtonCreate_Click); + // + // buttonLeft + // + this.buttonLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonLeft.BackgroundImage = global::RoadTrain.Properties.Resources.arrowLeft; + this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; + this.buttonLeft.Location = new System.Drawing.Point(771, 383); + this.buttonLeft.Name = "buttonLeft"; + this.buttonLeft.Size = new System.Drawing.Size(30, 30); + this.buttonLeft.TabIndex = 6; + this.buttonLeft.UseVisualStyleBackColor = true; + this.buttonLeft.Click += new System.EventHandler(this.ButtonMove_Click); + // + // buttonDown + // + this.buttonDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonDown.BackgroundImage = global::RoadTrain.Properties.Resources.arrowDown; + this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; + this.buttonDown.Location = new System.Drawing.Point(807, 383); + this.buttonDown.Name = "buttonDown"; + this.buttonDown.Size = new System.Drawing.Size(30, 30); + this.buttonDown.TabIndex = 7; + this.buttonDown.UseVisualStyleBackColor = true; + this.buttonDown.Click += new System.EventHandler(this.ButtonMove_Click); + // + // buttonUp + // + this.buttonUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonUp.BackgroundImage = global::RoadTrain.Properties.Resources.arrowUp; + this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; + this.buttonUp.Location = new System.Drawing.Point(807, 347); + this.buttonUp.Name = "buttonUp"; + this.buttonUp.Size = new System.Drawing.Size(30, 30); + this.buttonUp.TabIndex = 8; + this.buttonUp.UseVisualStyleBackColor = true; + this.buttonUp.Click += new System.EventHandler(this.ButtonMove_Click); + // + // buttonRight + // + this.buttonRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonRight.BackgroundImage = global::RoadTrain.Properties.Resources.arrowRight; + this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; + this.buttonRight.Location = new System.Drawing.Point(840, 384); + this.buttonRight.Name = "buttonRight"; + this.buttonRight.Size = new System.Drawing.Size(30, 30); + this.buttonRight.TabIndex = 9; + this.buttonRight.UseVisualStyleBackColor = true; + this.buttonRight.Click += new System.EventHandler(this.ButtonMove_Click); + // + // comboBoxSelectorMap + // + this.comboBoxSelectorMap.FormattingEnabled = true; + this.comboBoxSelectorMap.Items.AddRange(new object[] { + "Простая карта", + "Дорога"}); + this.comboBoxSelectorMap.Location = new System.Drawing.Point(23, 12); + this.comboBoxSelectorMap.Name = "comboBoxSelectorMap"; + this.comboBoxSelectorMap.Size = new System.Drawing.Size(151, 28); + this.comboBoxSelectorMap.TabIndex = 10; + this.comboBoxSelectorMap.SelectedIndexChanged += new System.EventHandler(this.ComboBoxSelectorMap_SelectedIndexChanged); + // + // buttonCreateModif + // + this.buttonCreateModif.Location = new System.Drawing.Point(145, 383); + this.buttonCreateModif.Name = "buttonCreateModif"; + this.buttonCreateModif.Size = new System.Drawing.Size(129, 29); + this.buttonCreateModif.TabIndex = 11; + this.buttonCreateModif.Text = "Модификация"; + this.buttonCreateModif.UseVisualStyleBackColor = true; + this.buttonCreateModif.Click += new System.EventHandler(this.ButtonCreateModif_Click); + // + // FormMap + // + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(882, 453); + this.Controls.Add(this.buttonCreateModif); + this.Controls.Add(this.comboBoxSelectorMap); + this.Controls.Add(this.buttonRight); + this.Controls.Add(this.buttonUp); + this.Controls.Add(this.buttonDown); + this.Controls.Add(this.buttonLeft); + this.Controls.Add(this.buttonCreate); + this.Controls.Add(this.pictureBoxRoadTrain); + this.Controls.Add(this.statusStripRoadTrain); + this.Name = "FormMap"; + this.Text = "Карта"; + this.statusStripRoadTrain.ResumeLayout(false); + this.statusStripRoadTrain.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBoxRoadTrain)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private StatusStrip statusStripRoadTrain; + private ToolStripStatusLabel toolStripStatusLabelSpeed; + private ToolStripStatusLabel toolStripStatusLabelWeight; + private ToolStripStatusLabel toolStripStatusLabelBodyColor; + private PictureBox pictureBoxRoadTrain; + private Button buttonCreate; + private Button buttonLeft; + private Button buttonDown; + private Button buttonUp; + private Button buttonRight; + private ComboBox comboBoxSelectorMap; + private Button buttonCreateModif; + } +} \ No newline at end of file diff --git a/RoadTrain/RoadTrain/FormMap.cs b/RoadTrain/RoadTrain/FormMap.cs new file mode 100644 index 0000000..ebabf90 --- /dev/null +++ b/RoadTrain/RoadTrain/FormMap.cs @@ -0,0 +1,108 @@ +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 RoadTrain +{ + public partial class FormMap : Form + { + private AbstractMap _abstractMap; + public FormMap() + { + InitializeComponent(); + _abstractMap = new SimpleMap(); + } + /// + /// Заполнение информации по объекту + /// + /// + private void SetData(DrawningRoadTrain roadTrain) + { + toolStripStatusLabelSpeed.Text = $"Скорость: {roadTrain.RoadTrain.Speed}"; + toolStripStatusLabelWeight.Text = $"Вес: {roadTrain.RoadTrain.Weight}"; + toolStripStatusLabelBodyColor.Text = $"Цвет: {roadTrain.RoadTrain.BodyColor.Name}"; + pictureBoxRoadTrain.Image = _abstractMap.CreateMap(pictureBoxRoadTrain.Width, pictureBoxRoadTrain.Height, new DrawningObjectRoadTrain(roadTrain)); + } + /// + /// Обработка нажатия кнопки "Создать" + /// + /// + /// + private void ButtonCreate_Click(object sender, EventArgs e) + { + Random rnd = new(); + var roadTrain = new DrawningRoadTrain(rnd.Next(100, 300), rnd.Next(1000, 2000), + Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256))); + SetData(roadTrain); + } + /// + /// Изменение размеров формы + /// + /// + /// + private void ButtonMove_Click(object sender, EventArgs e) + { + //получаем имя кнопки + string name = ((Button)sender)?.Name ?? string.Empty; + Direction dir = Direction.None; + switch (name) + { + case "buttonUp": + dir = Direction.Up; + break; + case "buttonDown": + dir = Direction.Down; + break; + case "buttonLeft": + dir = Direction.Left; + break; + case "buttonRight": + dir = Direction.Right; + break; + } + pictureBoxRoadTrain.Image = _abstractMap?.MoveObject(dir); + } + /// + /// Обработка нажатия кнопки "Модификация" + /// + /// + /// + private void ButtonCreateModif_Click(object sender, EventArgs e) + { + Random rnd = new(); + var roadTrain = new DrawningSweeperRoadTrain(rnd.Next(100, 300), rnd.Next(1000, + 2000), + 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))); + SetData(roadTrain); + } + /// + /// Смена карты + /// + /// + /// + private void ComboBoxSelectorMap_SelectedIndexChanged(object sender, + EventArgs e) + { + switch (comboBoxSelectorMap.Text) + { + case "Простая карта": + _abstractMap = new SimpleMap(); + break; + case "Дорога": + _abstractMap = new RoadMap(); + break; + } + } + } +} diff --git a/RoadTrain/RoadTrain/FormMap.resx b/RoadTrain/RoadTrain/FormMap.resx new file mode 100644 index 0000000..d855184 --- /dev/null +++ b/RoadTrain/RoadTrain/FormMap.resx @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/RoadTrain/RoadTrain/FormRoadTrain.Designer.cs b/RoadTrain/RoadTrain/FormRoadTrain.Designer.cs index b87c7a9..18890e8 100644 --- a/RoadTrain/RoadTrain/FormRoadTrain.Designer.cs +++ b/RoadTrain/RoadTrain/FormRoadTrain.Designer.cs @@ -28,7 +28,7 @@ /// private void InitializeComponent() { - this.statusStrip1 = new System.Windows.Forms.StatusStrip(); + this.statusStripRoadTrain = new System.Windows.Forms.StatusStrip(); this.toolStripStatusLabelSpeed = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripStatusLabelWeight = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripStatusLabelBodyColor = new System.Windows.Forms.ToolStripStatusLabel(); @@ -38,22 +38,22 @@ this.buttonRight = new System.Windows.Forms.Button(); this.buttonLeft = new System.Windows.Forms.Button(); this.buttonUp = new System.Windows.Forms.Button(); - this.statusStrip1.SuspendLayout(); + this.statusStripRoadTrain.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxRoadTrain)).BeginInit(); this.SuspendLayout(); // - // statusStrip1 + // statusStripRoadTrain // - this.statusStrip1.ImageScalingSize = new System.Drawing.Size(20, 20); - this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.statusStripRoadTrain.ImageScalingSize = new System.Drawing.Size(20, 20); + this.statusStripRoadTrain.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripStatusLabelSpeed, this.toolStripStatusLabelWeight, this.toolStripStatusLabelBodyColor}); - this.statusStrip1.Location = new System.Drawing.Point(0, 427); - this.statusStrip1.Name = "statusStrip1"; - this.statusStrip1.Size = new System.Drawing.Size(882, 26); - this.statusStrip1.TabIndex = 0; - this.statusStrip1.Text = "statusStrip1"; + this.statusStripRoadTrain.Location = new System.Drawing.Point(0, 427); + this.statusStripRoadTrain.Name = "statusStripRoadTrain"; + this.statusStripRoadTrain.Size = new System.Drawing.Size(882, 26); + this.statusStripRoadTrain.TabIndex = 0; + this.statusStripRoadTrain.Text = "statusStrip1"; // // toolStripStatusLabelSpeed // @@ -154,12 +154,12 @@ this.Controls.Add(this.buttonDown); this.Controls.Add(this.buttonCreate); this.Controls.Add(this.pictureBoxRoadTrain); - this.Controls.Add(this.statusStrip1); + this.Controls.Add(this.statusStripRoadTrain); this.Name = "FormRoadTrain"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Грузовик"; - this.statusStrip1.ResumeLayout(false); - this.statusStrip1.PerformLayout(); + this.statusStripRoadTrain.ResumeLayout(false); + this.statusStripRoadTrain.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxRoadTrain)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -168,7 +168,7 @@ #endregion - private StatusStrip statusStrip1; + private StatusStrip statusStripRoadTrain; private ToolStripStatusLabel toolStripStatusLabelSpeed; private ToolStripStatusLabel toolStripStatusLabelWeight; private ToolStripStatusLabel toolStripStatusLabelBodyColor; diff --git a/RoadTrain/RoadTrain/FormRoadTrain.cs b/RoadTrain/RoadTrain/FormRoadTrain.cs index 31681f9..5ce23b2 100644 --- a/RoadTrain/RoadTrain/FormRoadTrain.cs +++ b/RoadTrain/RoadTrain/FormRoadTrain.cs @@ -29,6 +29,17 @@ namespace RoadTrain pictureBoxRoadTrain.Image = bmp; } /// + /// Метод установки данных + /// + private void SetData() + { + Random rnd = new(); + _RoadTrain.SetPosition(rnd.Next(10, 100), rnd.Next(10, 100), pictureBoxRoadTrain.Width, pictureBoxRoadTrain.Height); + toolStripStatusLabelSpeed.Text = $"Скорость: {_RoadTrain.RoadTrain.Speed}"; + toolStripStatusLabelWeight.Text = $"Вес: {_RoadTrain.RoadTrain.Weight}"; + toolStripStatusLabelBodyColor.Text = $"Цвет: {_RoadTrain.RoadTrain.BodyColor.Name}"; + } + /// /// Обработка нажатия кнопки "Создать" /// /// @@ -36,14 +47,8 @@ namespace RoadTrain private void buttonCreate_Click(object sender, EventArgs e) { Random rnd = new(); - _RoadTrain = new DrawningRoadTrain(); - _RoadTrain.Init(rnd.Next(100, 300), rnd.Next(1000, 2000), - Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256))); - _RoadTrain.SetPosition(rnd.Next(10, 100), rnd.Next(10, 100), - pictureBoxRoadTrain.Width, pictureBoxRoadTrain.Height); - toolStripStatusLabelSpeed.Text = $"Скорость: {_RoadTrain.RoadTrain.Speed}"; - toolStripStatusLabelWeight.Text = $"Вес: {_RoadTrain.RoadTrain.Weight}"; - toolStripStatusLabelBodyColor.Text = $"Цвет: {_RoadTrain.RoadTrain.BodyColor.Name}"; + _RoadTrain = new DrawningRoadTrain(rnd.Next(100, 300), rnd.Next(1000, 2000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256))); + SetData(); Draw(); } @@ -83,6 +88,5 @@ namespace RoadTrain _RoadTrain?.ChangeBorders(pictureBoxRoadTrain.Width, pictureBoxRoadTrain.Height); Draw(); } - } } diff --git a/RoadTrain/RoadTrain/FormRoadTrain.resx b/RoadTrain/RoadTrain/FormRoadTrain.resx index 5cb320f..d855184 100644 --- a/RoadTrain/RoadTrain/FormRoadTrain.resx +++ b/RoadTrain/RoadTrain/FormRoadTrain.resx @@ -57,7 +57,7 @@ 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/RoadTrain/RoadTrain/IDrawningObject.cs b/RoadTrain/RoadTrain/IDrawningObject.cs new file mode 100644 index 0000000..73daff8 --- /dev/null +++ b/RoadTrain/RoadTrain/IDrawningObject.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace RoadTrain +{ + internal interface IDrawningObject + { + /// + /// Шаг перемещения объекта + /// + public float Step { get; } + /// + /// Установка позиции объекта + /// + /// Координата X + /// Координата Y + /// Ширина полотна + /// Высота полотна + void SetObject(int x, int y, int width, int height); + /// + /// Изменение направления пермещения объекта + /// + /// Направление + void MoveObject(Direction direction); + /// + /// Отрисовка объекта + /// + /// + void DrawningObject(Graphics g); + /// + /// Получение текущей позиции объекта + /// + /// + (float Left, float Top, float Right, float Bottom) GetCurrentPosition(); + + } +} diff --git a/RoadTrain/RoadTrain/Program.cs b/RoadTrain/RoadTrain/Program.cs index 9f812bd..3d0f0a1 100644 --- a/RoadTrain/RoadTrain/Program.cs +++ b/RoadTrain/RoadTrain/Program.cs @@ -12,7 +12,7 @@ // To customize application configuration such as set high DPI settings or default font, // see https://aka.ms/applicationconfiguration. ApplicationConfiguration.Initialize(); - Application.Run(new FormRoadTrain()); + Application.Run(new FormMap()); } } } \ No newline at end of file diff --git a/RoadTrain/RoadTrain/RoadMap.cs b/RoadTrain/RoadTrain/RoadMap.cs new file mode 100644 index 0000000..cd49328 --- /dev/null +++ b/RoadTrain/RoadTrain/RoadMap.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace RoadTrain +{ + internal class RoadMap : AbstractMap + { + /// + /// Цвет участка закрытого + /// + private readonly Brush barrierColor = new SolidBrush(Color.Green); + /// + /// Цвет участка открытого + /// + private readonly Brush roadColor = new SolidBrush(Color.DarkGray); + protected override void DrawBarrierPart(Graphics g, int i, int j) + { + g.FillRectangle(barrierColor, i * _size_x, j * _size_y, i * (_size_x + + 1), j * (_size_y + 1)); + } + protected override void DrawRoadPart(Graphics g, int i, int j) + { + g.FillRectangle(roadColor, i * _size_x, j * _size_y, i * (_size_x + + 1), j * (_size_y + 1)); + } + protected override void GenerateMap() + { + _map = new int[50, 50]; + _size_x = (float)_width / _map.GetLength(0); + _size_y = (float)_height / _map.GetLength(1); + int counter = 0; + for (int i = 0; i < _map.GetLength(0); ++i) + { + for (int j = 0; j < _map.GetLength(1); ++j) + { + _map[i, j] = _freeRoad; + } + } + while (counter < 20) + { + int x = _random.Next(0, 48); + int y = _random.Next(1, 49); + if (_map[x, y] == _freeRoad) + { + _map[x, y] = _barrier; + _map[x+1, y-1] = _barrier; + _map[x + 1, y] = _barrier; + _map[x + 2, y] = _barrier; + counter = counter + 4; + } + } + } + } +} diff --git a/RoadTrain/RoadTrain/SimpleMap.cs b/RoadTrain/RoadTrain/SimpleMap.cs new file mode 100644 index 0000000..d4b18ff --- /dev/null +++ b/RoadTrain/RoadTrain/SimpleMap.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace RoadTrain +{ + /// + /// Простая реализация абсрактного класса AbstractMap + /// + internal class SimpleMap : AbstractMap + { + /// + /// Цвет участка закрытого + /// + private readonly Brush barrierColor = new SolidBrush(Color.Black); + /// + /// Цвет участка открытого + /// + private readonly Brush roadColor = new SolidBrush(Color.Gray); + protected override void DrawBarrierPart(Graphics g, int i, int j) + { + g.FillRectangle(barrierColor, i * _size_x, j * _size_y, i * (_size_x + + 1), j * (_size_y + 1)); + } + protected override void DrawRoadPart(Graphics g, int i, int j) + { + g.FillRectangle(roadColor, i * _size_x, j * _size_y, i * (_size_x + + 1), j * (_size_y + 1)); + } + protected override void GenerateMap() + { + _map = new int[100, 100]; + _size_x = (float)_width / _map.GetLength(0); + _size_y = (float)_height / _map.GetLength(1); + int counter = 0; + for (int i = 0; i < _map.GetLength(0); ++i) + { + for (int j = 0; j < _map.GetLength(1); ++j) + { + _map[i, j] = _freeRoad; + } + } + while (counter < 50) + { + int x = _random.Next(0, 100); + int y = _random.Next(0, 100); + if (_map[x, y] == _freeRoad) + { + _map[x, y] = _barrier; + counter++; + } + } + } + } +} -- 2.25.1 From 6f7fd2b95e83cc084f1ecc5ceac3659f93d4c2d8 Mon Sep 17 00:00:00 2001 From: Saanechkaa Date: Wed, 12 Oct 2022 16:57:55 +0400 Subject: [PATCH 2/4] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B8=D1=82=D1=8C?= =?UTF-8?q?=20'RoadTrain/RoadTrain/Form1.resx'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- RoadTrain/RoadTrain/Form1.resx | 120 --------------------------------- 1 file changed, 120 deletions(-) delete mode 100644 RoadTrain/RoadTrain/Form1.resx diff --git a/RoadTrain/RoadTrain/Form1.resx b/RoadTrain/RoadTrain/Form1.resx deleted file mode 100644 index 1af7de1..0000000 --- a/RoadTrain/RoadTrain/Form1.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 -- 2.25.1 From 3c3b6da9de21a3faa546474bbd8a27af7fe1391f Mon Sep 17 00:00:00 2001 From: Saanechkaa Date: Wed, 12 Oct 2022 16:58:02 +0400 Subject: [PATCH 3/4] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B8=D1=82=D1=8C?= =?UTF-8?q?=20'RoadTrain/RoadTrain/Form1.cs'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- RoadTrain/RoadTrain/Form1.cs | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 RoadTrain/RoadTrain/Form1.cs diff --git a/RoadTrain/RoadTrain/Form1.cs b/RoadTrain/RoadTrain/Form1.cs deleted file mode 100644 index 8f6f5e9..0000000 --- a/RoadTrain/RoadTrain/Form1.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace RoadTrain -{ - public partial class Form1 : Form - { - public Form1() - { - InitializeComponent(); - } - } -} \ No newline at end of file -- 2.25.1 From b6ede7a8dbe1c212ce0029e304de1308a0ea7960 Mon Sep 17 00:00:00 2001 From: Saanechkaa Date: Wed, 12 Oct 2022 16:58:15 +0400 Subject: [PATCH 4/4] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B8=D1=82=D1=8C?= =?UTF-8?q?=20'RoadTrain/RoadTrain/Form1.Designer.cs'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- RoadTrain/RoadTrain/Form1.Designer.cs | 39 --------------------------- 1 file changed, 39 deletions(-) delete mode 100644 RoadTrain/RoadTrain/Form1.Designer.cs diff --git a/RoadTrain/RoadTrain/Form1.Designer.cs b/RoadTrain/RoadTrain/Form1.Designer.cs deleted file mode 100644 index 909c04d..0000000 --- a/RoadTrain/RoadTrain/Form1.Designer.cs +++ /dev/null @@ -1,39 +0,0 @@ -namespace RoadTrain -{ - partial class Form1 - { - /// - /// 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() - { - this.components = new System.ComponentModel.Container(); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(800, 450); - this.Text = "Form1"; - } - - #endregion - } -} \ No newline at end of file -- 2.25.1