From 827a7457b4e754b200c3a30d0de273a8ac3bf883 Mon Sep 17 00:00:00 2001 From: Nikita Potapov <47923521+nikita-potapov@users.noreply.github.com> Date: Wed, 12 Oct 2022 12:40:12 +0400 Subject: [PATCH] =?UTF-8?q?=D1=80=D0=B0=D0=B1=D0=BE=D1=87=D0=B8=D0=B9=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Direction.cs | 19 +++ .../Directions.cs | 16 -- .../DrawCatamaran.cs | 122 --------------- .../DrawingCatamaran.cs | 144 ++++++++++++++++++ .../EntityCatamaran.cs | 44 ++++-- .../Form.Designer.cs | 48 +++--- .../Form.cs | 40 ++--- .../Program.cs | 2 +- 8 files changed, 231 insertions(+), 204 deletions(-) create mode 100644 PIbd-21_Potapov_N.S._Catamaran_Base/PIbd-21_Potapov_N.S._Catamaran_Base/Direction.cs delete mode 100644 PIbd-21_Potapov_N.S._Catamaran_Base/PIbd-21_Potapov_N.S._Catamaran_Base/Directions.cs delete mode 100644 PIbd-21_Potapov_N.S._Catamaran_Base/PIbd-21_Potapov_N.S._Catamaran_Base/DrawCatamaran.cs create mode 100644 PIbd-21_Potapov_N.S._Catamaran_Base/PIbd-21_Potapov_N.S._Catamaran_Base/DrawingCatamaran.cs diff --git a/PIbd-21_Potapov_N.S._Catamaran_Base/PIbd-21_Potapov_N.S._Catamaran_Base/Direction.cs b/PIbd-21_Potapov_N.S._Catamaran_Base/PIbd-21_Potapov_N.S._Catamaran_Base/Direction.cs new file mode 100644 index 0000000..29917d0 --- /dev/null +++ b/PIbd-21_Potapov_N.S._Catamaran_Base/PIbd-21_Potapov_N.S._Catamaran_Base/Direction.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace PIbd_21_Potapov_N.S._Catamaran_Base +{ + /// + /// Направление перемещения + /// + internal enum Direction + { + Up = 1, + Down = 2, + Left = 3, + Right = 4 + } +} diff --git a/PIbd-21_Potapov_N.S._Catamaran_Base/PIbd-21_Potapov_N.S._Catamaran_Base/Directions.cs b/PIbd-21_Potapov_N.S._Catamaran_Base/PIbd-21_Potapov_N.S._Catamaran_Base/Directions.cs deleted file mode 100644 index 7ea5793..0000000 --- a/PIbd-21_Potapov_N.S._Catamaran_Base/PIbd-21_Potapov_N.S._Catamaran_Base/Directions.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace PIbd_21_Potapov_N.S._Catamaran_Base -{ - enum Directions - { - Up, - Down, - Left, - Right - } -} diff --git a/PIbd-21_Potapov_N.S._Catamaran_Base/PIbd-21_Potapov_N.S._Catamaran_Base/DrawCatamaran.cs b/PIbd-21_Potapov_N.S._Catamaran_Base/PIbd-21_Potapov_N.S._Catamaran_Base/DrawCatamaran.cs deleted file mode 100644 index 08fce9a..0000000 --- a/PIbd-21_Potapov_N.S._Catamaran_Base/PIbd-21_Potapov_N.S._Catamaran_Base/DrawCatamaran.cs +++ /dev/null @@ -1,122 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Drawing; -using System.Threading.Tasks; - -namespace PIbd_21_Potapov_N.S._Catamaran_Base -{ - class DrawCatamaran - { - public EntityCatamaran Catamaran { get; private set; } - private int _StartPosX; - private int _StartPosY; - public int? _PictureWidth = null; - public int? _PictureHeight = null; - private readonly int _CatamaranWidth = 80; - private readonly int _CatamaranHeight = 50; - - public void Init(float w, Color c, Directions d, float v) - { - EntityCatamaran entityCatamaran = new EntityCatamaran(); - entityCatamaran.Init(w, c, d, v); - Catamaran = entityCatamaran; - } - - public void SetPosition(int x, int y, int? width, int height) - { - //todo проверки - _StartPosX = x; - _StartPosY = y; - _PictureWidth = width; - _PictureHeight = height; - } - - public void MoveTransport(Directions direction) - { - if (!_PictureWidth.HasValue || !_PictureHeight.HasValue) - { - return; - } - - switch (direction) - { - case Directions.Up: - if (_StartPosY - Catamaran.Step > 0) - { - _StartPosY -= (int)Catamaran.Step; - } - break; - case Directions.Down: - if (_StartPosY + _CatamaranHeight + Catamaran.Step <= _PictureHeight) - { - _StartPosY += (int)Catamaran.Step; - } - break; - case Directions.Left: - if (_StartPosX - Catamaran.Step > 0) - { - _StartPosX -= (int)Catamaran.Step; - } - break; - case Directions.Right: - if (_StartPosX + _CatamaranWidth + Catamaran.Step < _PictureWidth) - { - _StartPosX += (int)Catamaran.Step; - } - break; - default: - break; - } - } - - public void DrawTransport(Graphics g) - { - - int nx = _StartPosX; - int ny = _StartPosY; - - // Корпус катамарана - g.DrawLine(Pens.Black, nx, ny, nx + _CatamaranWidth - 10, ny); - g.DrawLine(Pens.Black, nx, ny + _CatamaranHeight, nx + _CatamaranWidth - 10, ny + _CatamaranHeight); - - g.DrawLine(Pens.Black, nx, ny, nx, ny + _CatamaranHeight); - g.DrawLine(Pens.Black, nx + _CatamaranWidth, ny + 10, nx + _CatamaranWidth, ny + _CatamaranHeight - 10); - - g.DrawLine(Pens.Black, nx + _CatamaranWidth - 10, ny, nx + _CatamaranWidth, ny + 10); - g.DrawLine(Pens.Black, nx + _CatamaranWidth - 10, ny + _CatamaranHeight, nx + _CatamaranWidth, ny + _CatamaranHeight - 10); - // - - g.DrawEllipse(Pens.Black, nx + 10, ny + 10, _CatamaranWidth - 20, _CatamaranHeight - 20); - - } - - public void ChangeBorders(int nwidth, int nheight) - { - _PictureWidth = nwidth; - _PictureHeight = nheight; - if (_PictureWidth <= _CatamaranWidth || _PictureHeight <= _CatamaranHeight) - { - _PictureWidth = null; - _PictureHeight = null; - return; - } - if (_StartPosX + _CatamaranWidth > _PictureWidth) - { - _StartPosX = _PictureWidth.Value - _CatamaranWidth; - } - if (_StartPosY + _CatamaranHeight > _PictureHeight) - { - _StartPosY = _PictureHeight.Value - _CatamaranHeight; - } - } - - public string GetStatus() - { - string status = ""; - status += "Pos: " + _StartPosX + ", " + _StartPosY; - return status; - } - } -} diff --git a/PIbd-21_Potapov_N.S._Catamaran_Base/PIbd-21_Potapov_N.S._Catamaran_Base/DrawingCatamaran.cs b/PIbd-21_Potapov_N.S._Catamaran_Base/PIbd-21_Potapov_N.S._Catamaran_Base/DrawingCatamaran.cs new file mode 100644 index 0000000..c2fbf94 --- /dev/null +++ b/PIbd-21_Potapov_N.S._Catamaran_Base/PIbd-21_Potapov_N.S._Catamaran_Base/DrawingCatamaran.cs @@ -0,0 +1,144 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Drawing; +using System.Threading.Tasks; +using PIbd_21_Potapov_N.S._Catamaran_Base; + +namespace PIbd_21_Potapov_N.S._Catamaran_Base +{ + /// + /// Класс, отвечающий за прорисовку и перемещение объекта-сущности + /// + internal class DrawingCatamaran + { + /// + /// Класс-сущность + /// + public EntityCatamaran Catamaran { protected set; get; } + /// + /// Левая координата отрисовки катамарана + /// + private float _startPosX; + /// + /// Верхняя кооридната отрисовки катамарана + /// + private float _startPosY; + /// + /// Ширина окна отрисовки + /// + private int? _pictureWidth = null; + /// + /// Высота окна отрисовки + /// + private int? _pictureHeight = null; + /// + /// Ширина отрисовки катамарана + /// + private readonly int _catamaranWidth = 100; + /// + /// Высота отрисовки катамарана + /// + private readonly int _catamaranHeight = 40; + /// + /// Инициализация свойств + /// + /// Скорость + /// Вес катамарана + /// Цвет корпуса + public void Init(int speed, float weight, Color bodyColor) + { + Catamaran = new EntityCatamaran(); + Catamaran.Init(speed, weight, bodyColor); + } + /// + /// Установка позиции катамарана + /// + /// Координата X + /// Координата Y + /// Ширина картинки + /// Высота картинки + public void SetPosition(int x, int y, int width, int height) + { + // TODO проверки + _startPosX = x; + _startPosY = y; + _pictureWidth = width; + _pictureHeight = height; + } + /// + /// Изменение направления перемещения + /// + /// Направление + public void MoveTransport(Direction direction) + { + if (!_pictureWidth.HasValue || !_pictureHeight.HasValue) + { + return; + } + switch (direction) + { + // вправо + case Direction.Right: + if (_startPosX + _catamaranWidth + Catamaran.Step < _pictureWidth) + { + _startPosX += Catamaran.Step; + } + break; + //влево + case Direction.Left: + if (_startPosX - Catamaran.Step > 0) + { + _startPosX -= Catamaran.Step; + } + break; + //вверх + case Direction.Up: + if (_startPosY - Catamaran.Step > 0) + { + _startPosY -= Catamaran.Step; + } + break; + //вниз + case Direction.Down: + if (_startPosY + _catamaranHeight + Catamaran.Step < _pictureHeight) + { + _startPosY += Catamaran.Step; + } + break; + } + } + /// + /// Отрисовка катамарана + /// + /// + public void DrawTransport(Graphics g) + { + if (_startPosX < 0 || _startPosY < 0 + || !_pictureHeight.HasValue || !_pictureWidth.HasValue) + { + return; + } + + SolidBrush brush = new SolidBrush(Catamaran.BodyColor); + + PointF[] bodyPoints = new PointF[5]; + bodyPoints[0] = new PointF(_startPosX, _startPosY); + bodyPoints[1] = new PointF(_startPosX + _catamaranWidth - _catamaranWidth / 4, _startPosY); + bodyPoints[2] = new PointF(_startPosX + _catamaranWidth, _startPosY + _catamaranHeight / 2); + bodyPoints[3] = new PointF(_startPosX + _catamaranWidth - _catamaranWidth / 4, _startPosY + _catamaranHeight); + bodyPoints[4] = new PointF(_startPosX, _startPosY + _catamaranHeight); + + // Отрисовка корпуса катамарана + g.FillPolygon(brush, bodyPoints); + g.DrawPolygon(Pens.Black, bodyPoints); + + // Отрисовка головы катамарана + g.FillEllipse(Brushes.White, _startPosX + _catamaranWidth / 8, _startPosY + _catamaranHeight / 8, + _catamaranWidth / 2, _catamaranHeight - _catamaranHeight / 4); + g.DrawEllipse(Pens.Black, _startPosX + _catamaranWidth / 8, _startPosY + _catamaranHeight / 8, + _catamaranWidth / 2, _catamaranHeight - _catamaranHeight / 4); + } + } +} diff --git a/PIbd-21_Potapov_N.S._Catamaran_Base/PIbd-21_Potapov_N.S._Catamaran_Base/EntityCatamaran.cs b/PIbd-21_Potapov_N.S._Catamaran_Base/PIbd-21_Potapov_N.S._Catamaran_Base/EntityCatamaran.cs index 6cdfa90..147eb5d 100644 --- a/PIbd-21_Potapov_N.S._Catamaran_Base/PIbd-21_Potapov_N.S._Catamaran_Base/EntityCatamaran.cs +++ b/PIbd-21_Potapov_N.S._Catamaran_Base/PIbd-21_Potapov_N.S._Catamaran_Base/EntityCatamaran.cs @@ -7,22 +7,40 @@ using System.Drawing; namespace PIbd_21_Potapov_N.S._Catamaran_Base { - class EntityCatamaran + /// + /// Класс-сущность "Автомобиль" + /// + internal class EntityCatamaran { + /// + /// Скорость + /// + public int Speed { get; private set; } + /// + /// Вес + /// public float Weight { get; private set; } - public Color EntityColor { get; private set; } - public Directions Direction { get; private set; } - public float Speed { get; private set; } - public float Step { get; private set; } - - public void Init(float w, Color c, Directions d, float v) + /// + /// Цвет корпуса + /// + public Color BodyColor { get; private set; } + /// + /// Шаг перемещения катамарана + /// + public float Step => Speed * 100 / Weight; + /// + /// Инициализация полей объекта-класса катамарана + /// + /// + /// + /// + /// + public void Init(int speed, float weight, Color bodyColor) { - Random rnd = new Random(); - Speed = (v <= 0 ? rnd.Next(50, 100) : v); - Weight = (w <= 0 ? rnd.Next(40, 80) : w); - EntityColor = c; - Direction = d; - Step = Speed * 100 / Weight; + Random rnd = new(); + Speed = speed <= 0 ? rnd.Next(50, 150) : speed; + Weight = weight <= 0 ? rnd.Next(40, 70) : weight; + BodyColor = bodyColor; } } } diff --git a/PIbd-21_Potapov_N.S._Catamaran_Base/PIbd-21_Potapov_N.S._Catamaran_Base/Form.Designer.cs b/PIbd-21_Potapov_N.S._Catamaran_Base/PIbd-21_Potapov_N.S._Catamaran_Base/Form.Designer.cs index 890a43c..f1810d6 100644 --- a/PIbd-21_Potapov_N.S._Catamaran_Base/PIbd-21_Potapov_N.S._Catamaran_Base/Form.Designer.cs +++ b/PIbd-21_Potapov_N.S._Catamaran_Base/PIbd-21_Potapov_N.S._Catamaran_Base/Form.Designer.cs @@ -1,7 +1,7 @@  namespace PIbd_21_Potapov_N.S._Catamaran_Base { - partial class Form + partial class FormCatamaran { /// /// Required designer variable. @@ -47,11 +47,11 @@ namespace PIbd_21_Potapov_N.S._Catamaran_Base // // btn_new // - this.btn_new.Location = new System.Drawing.Point(12, 327); + this.btn_new.Location = new System.Drawing.Point(12, 344); this.btn_new.Name = "btn_new"; - this.btn_new.Size = new System.Drawing.Size(75, 60); + this.btn_new.Size = new System.Drawing.Size(75, 63); this.btn_new.TabIndex = 10; - this.btn_new.Text = "New"; + this.btn_new.Text = "Создать"; this.btn_new.Click += new System.EventHandler(this.btn_new_Click); // // statusStrip @@ -61,28 +61,28 @@ namespace PIbd_21_Potapov_N.S._Catamaran_Base this.toolStripStatusLabelSpeed, this.toolStripStatusLabelWeight, this.toolStripStatusLabelColor}); - this.statusStrip.Location = new System.Drawing.Point(0, 395); + this.statusStrip.Location = new System.Drawing.Point(0, 415); this.statusStrip.Name = "statusStrip"; - this.statusStrip.Size = new System.Drawing.Size(1074, 24); + this.statusStrip.Size = new System.Drawing.Size(1074, 26); this.statusStrip.TabIndex = 8; this.statusStrip.Text = "statusStrip"; // // toolStripStatusLabelSpeed // this.toolStripStatusLabelSpeed.Name = "toolStripStatusLabelSpeed"; - this.toolStripStatusLabelSpeed.Size = new System.Drawing.Size(75, 19); + this.toolStripStatusLabelSpeed.Size = new System.Drawing.Size(80, 20); this.toolStripStatusLabelSpeed.Text = "Скорость: "; // // toolStripStatusLabelWeight // this.toolStripStatusLabelWeight.Name = "toolStripStatusLabelWeight"; - this.toolStripStatusLabelWeight.Size = new System.Drawing.Size(37, 19); + this.toolStripStatusLabelWeight.Size = new System.Drawing.Size(40, 20); this.toolStripStatusLabelWeight.Text = "Вес: "; // // toolStripStatusLabelColor // this.toolStripStatusLabelColor.Name = "toolStripStatusLabelColor"; - this.toolStripStatusLabelColor.Size = new System.Drawing.Size(46, 19); + this.toolStripStatusLabelColor.Size = new System.Drawing.Size(49, 20); this.toolStripStatusLabelColor.Text = "Цвет: "; // // groupBox @@ -92,11 +92,11 @@ namespace PIbd_21_Potapov_N.S._Catamaran_Base this.groupBox.Controls.Add(this.btn_down); this.groupBox.Controls.Add(this.btn_left); this.groupBox.Controls.Add(this.btn_right); - this.groupBox.Location = new System.Drawing.Point(923, 309); + this.groupBox.Location = new System.Drawing.Point(923, 325); this.groupBox.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.groupBox.Name = "groupBox"; this.groupBox.Padding = new System.Windows.Forms.Padding(3, 4, 3, 4); - this.groupBox.Size = new System.Drawing.Size(139, 84); + this.groupBox.Size = new System.Drawing.Size(139, 88); this.groupBox.TabIndex = 9; this.groupBox.TabStop = false; // @@ -107,7 +107,7 @@ namespace PIbd_21_Potapov_N.S._Catamaran_Base this.btn_up.Location = new System.Drawing.Point(51, 0); this.btn_up.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.btn_up.Name = "btn_up"; - this.btn_up.Size = new System.Drawing.Size(40, 38); + this.btn_up.Size = new System.Drawing.Size(40, 40); this.btn_up.TabIndex = 1; this.btn_up.UseVisualStyleBackColor = true; this.btn_up.Click += new System.EventHandler(this.btn_move_Click); @@ -116,10 +116,10 @@ namespace PIbd_21_Potapov_N.S._Catamaran_Base // this.btn_down.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; this.btn_down.Image = global::PIbd_21_Potapov_N.S._Catamaran_Base.Properties.Resources.arrow_down1; - this.btn_down.Location = new System.Drawing.Point(51, 40); + this.btn_down.Location = new System.Drawing.Point(51, 42); this.btn_down.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.btn_down.Name = "btn_down"; - this.btn_down.Size = new System.Drawing.Size(40, 38); + this.btn_down.Size = new System.Drawing.Size(40, 40); this.btn_down.TabIndex = 2; this.btn_down.Text = " "; this.btn_down.UseVisualStyleBackColor = true; @@ -129,10 +129,10 @@ namespace PIbd_21_Potapov_N.S._Catamaran_Base // this.btn_left.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; this.btn_left.Image = global::PIbd_21_Potapov_N.S._Catamaran_Base.Properties.Resources.arrow_left1; - this.btn_left.Location = new System.Drawing.Point(5, 40); + this.btn_left.Location = new System.Drawing.Point(5, 42); this.btn_left.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.btn_left.Name = "btn_left"; - this.btn_left.Size = new System.Drawing.Size(40, 38); + this.btn_left.Size = new System.Drawing.Size(40, 40); this.btn_left.TabIndex = 3; this.btn_left.UseVisualStyleBackColor = true; this.btn_left.Click += new System.EventHandler(this.btn_move_Click); @@ -141,10 +141,10 @@ namespace PIbd_21_Potapov_N.S._Catamaran_Base // this.btn_right.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; this.btn_right.Image = global::PIbd_21_Potapov_N.S._Catamaran_Base.Properties.Resources.arrow_right1; - this.btn_right.Location = new System.Drawing.Point(97, 42); + this.btn_right.Location = new System.Drawing.Point(97, 44); this.btn_right.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.btn_right.Name = "btn_right"; - this.btn_right.Size = new System.Drawing.Size(40, 38); + this.btn_right.Size = new System.Drawing.Size(40, 40); this.btn_right.TabIndex = 4; this.btn_right.UseVisualStyleBackColor = true; this.btn_right.Click += new System.EventHandler(this.btn_move_Click); @@ -155,23 +155,23 @@ namespace PIbd_21_Potapov_N.S._Catamaran_Base this.pictureBox.Location = new System.Drawing.Point(0, 0); this.pictureBox.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.pictureBox.Name = "pictureBox"; - this.pictureBox.Size = new System.Drawing.Size(1074, 419); + this.pictureBox.Size = new System.Drawing.Size(1074, 441); this.pictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.pictureBox.TabIndex = 0; this.pictureBox.TabStop = false; // - // Form + // FormCatamaran // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 19F); + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1074, 419); + this.ClientSize = new System.Drawing.Size(1074, 441); this.Controls.Add(this.groupBox); this.Controls.Add(this.btn_new); this.Controls.Add(this.statusStrip); this.Controls.Add(this.pictureBox); this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); - this.Name = "Form"; - this.Text = "CatamaranTest"; + this.Name = "FormCatamaran"; + this.Text = "Катамаран"; this.statusStrip.ResumeLayout(false); this.statusStrip.PerformLayout(); this.groupBox.ResumeLayout(false); diff --git a/PIbd-21_Potapov_N.S._Catamaran_Base/PIbd-21_Potapov_N.S._Catamaran_Base/Form.cs b/PIbd-21_Potapov_N.S._Catamaran_Base/PIbd-21_Potapov_N.S._Catamaran_Base/Form.cs index d1103b3..6ca1d1c 100644 --- a/PIbd-21_Potapov_N.S._Catamaran_Base/PIbd-21_Potapov_N.S._Catamaran_Base/Form.cs +++ b/PIbd-21_Potapov_N.S._Catamaran_Base/PIbd-21_Potapov_N.S._Catamaran_Base/Form.cs @@ -10,11 +10,11 @@ using System.Windows.Forms; namespace PIbd_21_Potapov_N.S._Catamaran_Base { - public partial class Form : System.Windows.Forms.Form + public partial class FormCatamaran : System.Windows.Forms.Form { - DrawCatamaran catamaranDrawObj; + DrawingCatamaran catamaranDrawObj; - public Form() + public FormCatamaran() { InitializeComponent(); pictureBox.Image = new Bitmap(pictureBox.Width, pictureBox.Height); @@ -22,14 +22,14 @@ namespace PIbd_21_Potapov_N.S._Catamaran_Base private void btn_new_Click(object sender, EventArgs e) { - Random rnd = new Random(); + Random rnd = new Random(); - catamaranDrawObj = new DrawCatamaran(); - catamaranDrawObj.Init(rnd.Next(50, 100), Color.FromArgb(rnd.Next(0, 255), rnd.Next(0, 255), rnd.Next(0, 255)), Directions.Right, 20); - catamaranDrawObj.SetPosition(rnd.Next(10, 50), rnd.Next(10, 50), pictureBox.Width, pictureBox.Height); + catamaranDrawObj = new DrawingCatamaran(); + catamaranDrawObj.Init(rnd.Next(50, 100), rnd.Next(50, 100), Color.FromArgb(rnd.Next(0, 255), rnd.Next(0, 255), rnd.Next(0, 255))); + catamaranDrawObj.SetPosition(rnd.Next(10, 50), rnd.Next(10, 50), pictureBox.Width, pictureBox.Height - statusStrip.Height); toolStripStatusLabelSpeed.Text = $"Скорость: {catamaranDrawObj.Catamaran.Speed}"; toolStripStatusLabelWeight.Text = $"Вес: {catamaranDrawObj.Catamaran.Weight}"; - toolStripStatusLabelColor.Text = $"Цвет: {catamaranDrawObj.Catamaran.EntityColor.Name}"; + toolStripStatusLabelColor.Text = $"Цвет: {catamaranDrawObj.Catamaran.BodyColor.Name}"; RedrawCatamaran(); } @@ -44,22 +44,22 @@ namespace PIbd_21_Potapov_N.S._Catamaran_Base { case "btn_up": { - catamaranDrawObj.MoveTransport(Directions.Up); + catamaranDrawObj.MoveTransport(Direction.Up); } break; case "btn_down": { - catamaranDrawObj.MoveTransport(Directions.Down); + catamaranDrawObj.MoveTransport(Direction.Down); } break; case "btn_left": { - catamaranDrawObj.MoveTransport(Directions.Left); + catamaranDrawObj.MoveTransport(Direction.Left); } break; case "btn_right": { - catamaranDrawObj.MoveTransport(Directions.Right); + catamaranDrawObj.MoveTransport(Direction.Right); } break; default: @@ -75,21 +75,5 @@ namespace PIbd_21_Potapov_N.S._Catamaran_Base catamaranDrawObj.DrawTransport(g); pictureBox.Invalidate(); } - - private void UpdateStatus() - { - if (catamaranDrawObj == null) - return; - - } - - private void form_Resize(object sender, EventArgs e) - { - - int oldWidth = pictureBox.Width; - int oldHeight = pictureBox.Height; - - } - } } diff --git a/PIbd-21_Potapov_N.S._Catamaran_Base/PIbd-21_Potapov_N.S._Catamaran_Base/Program.cs b/PIbd-21_Potapov_N.S._Catamaran_Base/PIbd-21_Potapov_N.S._Catamaran_Base/Program.cs index 5531eb1..683f79a 100644 --- a/PIbd-21_Potapov_N.S._Catamaran_Base/PIbd-21_Potapov_N.S._Catamaran_Base/Program.cs +++ b/PIbd-21_Potapov_N.S._Catamaran_Base/PIbd-21_Potapov_N.S._Catamaran_Base/Program.cs @@ -17,7 +17,7 @@ namespace PIbd_21_Potapov_N.S._Catamaran_Base Application.EnableVisualStyles(); Application.SetHighDpiMode(HighDpiMode.SystemAware); Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new Form()); + Application.Run(new FormCatamaran()); } } }