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}";