From ee9c15b506bb664749b2810c266cb5eb4465e771 Mon Sep 17 00:00:00 2001 From: Oleg Date: Fri, 30 Sep 2022 11:22:36 +0400 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=BE=20=D0=BF=D0=B5=D1=80=D0=B5=D0=BC=D0=B5=D1=89?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B2=D0=BB=D0=B5=D0=B2=D0=BE=20?= =?UTF-8?q?=D0=B8=20=D0=B2=D0=B2=D0=B5=D1=80=D1=85.=20=D0=98=D1=81=D0=BF?= =?UTF-8?q?=D1=80=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=20pictureBox?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Trolleybus/Trolleybus/DrawingTrolleybus.cs | 14 +++++++------- Trolleybus/Trolleybus/Form1.Designer.cs | 4 ++-- Trolleybus/Trolleybus/Form1.cs | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Trolleybus/Trolleybus/DrawingTrolleybus.cs b/Trolleybus/Trolleybus/DrawingTrolleybus.cs index d963d78..a2e0bdf 100644 --- a/Trolleybus/Trolleybus/DrawingTrolleybus.cs +++ b/Trolleybus/Trolleybus/DrawingTrolleybus.cs @@ -25,11 +25,11 @@ namespace Trolleybus /// /// левая координата начала отрисовки /// - private float _startX; + //private float _startX; /// /// Верхняя координата начала отрисовки /// - private float _startY; + //private float _startY; /// /// Ширина окна отрисовки /// @@ -65,12 +65,12 @@ namespace Trolleybus /// Ширина картинки /// Высота картинки // public void SetPosition(int x, int y, int startX, int startY, int width, int height) - public void SetPosition(int x, int y, int startX, int startY, int width, int height) + public void SetPosition(int x, int y, int width, int height) { _startPosX = x; _startPosY = y; - _startX = startX; - _startY = startY; +// _startX = startX; +// _startY = startY; _pictureWidth = width; _pictureHeight = height; } @@ -95,14 +95,14 @@ namespace Trolleybus break; //влево case Direction.Left: - if (_startPosX > _startX) + if (_startPosX - Trolleybus.Step > 0) { _startPosX -= Trolleybus.Step; } break; //вверх case Direction.Up: - if (_startPosY > _startY) + if (_startPosY - Trolleybus.Step > 0) { _startPosY -= Trolleybus.Step; } diff --git a/Trolleybus/Trolleybus/Form1.Designer.cs b/Trolleybus/Trolleybus/Form1.Designer.cs index 7160c1d..46cbfec 100644 --- a/Trolleybus/Trolleybus/Form1.Designer.cs +++ b/Trolleybus/Trolleybus/Form1.Designer.cs @@ -129,9 +129,9 @@ namespace Trolleybus // // pictureBoxTrolleybus // - this.pictureBoxTrolleybus.Location = new System.Drawing.Point(12, 12); + this.pictureBoxTrolleybus.Location = new System.Drawing.Point(0, -1); this.pictureBoxTrolleybus.Name = "pictureBoxTrolleybus"; - this.pictureBoxTrolleybus.Size = new System.Drawing.Size(776, 413); + this.pictureBoxTrolleybus.Size = new System.Drawing.Size(800, 451); this.pictureBoxTrolleybus.TabIndex = 0; this.pictureBoxTrolleybus.TabStop = false; // diff --git a/Trolleybus/Trolleybus/Form1.cs b/Trolleybus/Trolleybus/Form1.cs index 07959cc..0fb3bf8 100644 --- a/Trolleybus/Trolleybus/Form1.cs +++ b/Trolleybus/Trolleybus/Form1.cs @@ -40,8 +40,8 @@ namespace Trolleybus Random rnd = new Random(); _trolleybus = new DrawingTrolleybus(); _trolleybus.Init(rnd.Next(100, 300), rnd.Next(1000, 2000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256))); - _trolleybus.SetPosition(rnd.Next(10, 100), rnd.Next(10, 100), Location.X, Location.Y, pictureBoxTrolleybus.Width, pictureBoxTrolleybus.Height); -// _trolleybus.SetPosition(rnd.Next(10, 100), rnd.Next(10, 100), pictureBoxTrolleybus.Width, pictureBoxTrolleybus.Height); + //_trolleybus.SetPosition(rnd.Next(10, 100), rnd.Next(10, 100), Location.X, Location.Y, pictureBoxTrolleybus.Width, pictureBoxTrolleybus.Height); + _trolleybus.SetPosition(rnd.Next(10, 100), rnd.Next(pictureBoxTrolleybus.Size.Height - 150, pictureBoxTrolleybus.Size.Height - 100), pictureBoxTrolleybus.Width, pictureBoxTrolleybus.Height); toolStripStatusLabelSpeed.Text = $"Скорость: {_trolleybus.Trolleybus.Speed}"; toolStripStatusLabelWeight.Text = $"Вес: {_trolleybus.Trolleybus.Weight}"; toolStripStatusLabelBodyColor.Text = $"Цвет: {_trolleybus.Trolleybus.BodyColor.Name}";