From 2890635d2525d94803f96cc4ac84defd3bffe5dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D1=80=D0=B8=D1=8F=20=D0=9A=D0=BE=D1=82=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0?= Date: Wed, 14 Feb 2024 00:27:00 +0400 Subject: [PATCH 1/3] =?UTF-8?q?=D0=9B=D0=B0=D0=B1=D0=BE=D1=80=D0=B0=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=BD=D0=B0=D1=8F=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=B0=E2=84=961?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WinFormsAppExcavator/DirectionType.cs | 26 ++ .../WinFormsAppExcavator/DrawingExcavator.cs | 245 ++++++++++++++++++ .../WinFormsAppExcavator/EntityExcavator.cs | 70 +++++ .../WinFormsAppExcavator/Form1.Designer.cs | 39 --- .../WinFormsAppExcavator/Form1.cs | 10 - .../FormExcavator.Designer.cs | 135 ++++++++++ .../WinFormsAppExcavator/FormExcavator.cs | 93 +++++++ .../{Form1.resx => FormExcavator.resx} | 50 ++-- .../WinFormsAppExcavator/Program.cs | 4 +- .../Properties/Resources.Designer.cs | 103 ++++++++ .../Properties/Resources.resx | 133 ++++++++++ .../WinFormsAppExcavator/Resources/Down.bmp | Bin 0 -> 989 bytes .../WinFormsAppExcavator/Resources/Left.png | Bin 0 -> 1012 bytes .../WinFormsAppExcavator/Resources/Right.bmp | Bin 0 -> 988 bytes .../WinFormsAppExcavator/Resources/Up.png | Bin 0 -> 1424 bytes .../WinFormsAppExcavator.csproj | 15 ++ 16 files changed, 847 insertions(+), 76 deletions(-) create mode 100644 WinFormsAppExcavator/WinFormsAppExcavator/DirectionType.cs create mode 100644 WinFormsAppExcavator/WinFormsAppExcavator/DrawingExcavator.cs create mode 100644 WinFormsAppExcavator/WinFormsAppExcavator/EntityExcavator.cs delete mode 100644 WinFormsAppExcavator/WinFormsAppExcavator/Form1.Designer.cs delete mode 100644 WinFormsAppExcavator/WinFormsAppExcavator/Form1.cs create mode 100644 WinFormsAppExcavator/WinFormsAppExcavator/FormExcavator.Designer.cs create mode 100644 WinFormsAppExcavator/WinFormsAppExcavator/FormExcavator.cs rename WinFormsAppExcavator/WinFormsAppExcavator/{Form1.resx => FormExcavator.resx} (93%) create mode 100644 WinFormsAppExcavator/WinFormsAppExcavator/Properties/Resources.Designer.cs create mode 100644 WinFormsAppExcavator/WinFormsAppExcavator/Properties/Resources.resx create mode 100644 WinFormsAppExcavator/WinFormsAppExcavator/Resources/Down.bmp create mode 100644 WinFormsAppExcavator/WinFormsAppExcavator/Resources/Left.png create mode 100644 WinFormsAppExcavator/WinFormsAppExcavator/Resources/Right.bmp create mode 100644 WinFormsAppExcavator/WinFormsAppExcavator/Resources/Up.png diff --git a/WinFormsAppExcavator/WinFormsAppExcavator/DirectionType.cs b/WinFormsAppExcavator/WinFormsAppExcavator/DirectionType.cs new file mode 100644 index 0000000..e3600da --- /dev/null +++ b/WinFormsAppExcavator/WinFormsAppExcavator/DirectionType.cs @@ -0,0 +1,26 @@ +namespace WinFormsAppExcavator; + +/// +/// направление перемещения +/// +public enum DirectionType +{ + /// + /// Вверх + /// + Up=1, + /// + /// Вниз + /// + Down=2, + /// + /// Влево + /// + Left=3, + /// + /// Вправо + /// + Right=4, + +} + diff --git a/WinFormsAppExcavator/WinFormsAppExcavator/DrawingExcavator.cs b/WinFormsAppExcavator/WinFormsAppExcavator/DrawingExcavator.cs new file mode 100644 index 0000000..6d69187 --- /dev/null +++ b/WinFormsAppExcavator/WinFormsAppExcavator/DrawingExcavator.cs @@ -0,0 +1,245 @@ +namespace WinFormsAppExcavator; + +/// +/// Класс, отвечающий за прорисовку и передвижение объекта сущности +/// +public class DrawingExcavator +{ + /// + /// Класс-сущность + /// + public EntityExcavator? EntityExcavator { get; private set; } + + /// + /// Ширина окна + /// + private int? _pictureWidth; + + /// + /// Высота окна + /// + private int? _pictureHeight; + + /// + /// Левая координата прорисовки экскаватора + /// + private int? _startPosX; + + /// + /// Верхняя кооридната прорисовки экскаватора + /// + private int? _startPosY; + + /// + /// Ширина прорисовки экскаватора + /// + private readonly int _drawningExcavatorWidth = 175; + + /// + /// Высота прорисовки экскаватора + /// + private readonly int _drawningExcavatorHeight =80; + + + /// + /// Инициализация свойств + /// + /// Скорость + /// Вес + /// Основной цвет + /// Дополнительный цвет + /// Признак наличия обвеса + /// Признак наличия антикрыла + /// Признак наличия гоночной полосы + public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool bucket, bool support, bool bulldozerDump) + { + EntityExcavator = new EntityExcavator(); + EntityExcavator.Init(speed, weight, bodyColor, additionalColor, bucket, support, bulldozerDump); + _pictureWidth = null; + _pictureHeight = null; + _startPosX = null; + _startPosY = null; + } + + /// + /// Установка границ поля + /// + /// Ширина поля + /// Высота поля + /// true - границы заданы, false - проверка не пройдена, нельзя разместить объект в этих размерах + public bool SetPictureSize(int width, int height) + { + + if (_drawningExcavatorWidth < width && _drawningExcavatorHeight < height) + { + _pictureWidth = width; + _pictureHeight = height; + return true; + } + else { return false; } + } + + /// + /// Установка позиции + /// + /// Координата X + /// Координата Y + public void SetPosition(int x, int y) + { + if (!_pictureHeight.HasValue || !_pictureWidth.HasValue) + { + return; + } + if (x > 0 && y > 0 && x + _drawningExcavatorWidth < _pictureWidth && _drawningExcavatorHeight + y < _pictureHeight) + { + _startPosX = x; + _startPosY = y; + } + else + { + _startPosX = 10; + _startPosY = 10; + } + } + + /// + /// Изменение направления перемещения + /// + /// Направление + /// true - перемещение выполнено, false - перемещение невозможно + public bool MoveTransport(DirectionType direction) + { + if (EntityExcavator == null || !_startPosX.HasValue || !_startPosY.HasValue) + { + return false; + } + + switch (direction) + { + //влево + case DirectionType.Left: + if (_startPosX.Value - EntityExcavator.Step > 0) + { + _startPosX -= (int)EntityExcavator.Step; + } + return true; + //вверх + case DirectionType.Up: + if (_startPosY.Value - EntityExcavator.Step > 0) + { + _startPosY -= (int)EntityExcavator.Step; + } + return true; + // вправо + case DirectionType.Right: + if (_startPosX.Value+_drawningExcavatorWidth + EntityExcavator.Step < _pictureWidth) + { + _startPosX += (int)EntityExcavator.Step; + } + return true; + //вниз + case DirectionType.Down: + if (_startPosY.Value+_drawningExcavatorHeight + EntityExcavator.Step< _pictureHeight) + { + _startPosY += (int)EntityExcavator.Step; + } + return true; + default: + return false; + } + } + + /// + /// Прорисовка объекта + /// + /// + public void DrawTransport(Graphics g) + { + if (EntityExcavator == null || !_startPosX.HasValue || !_startPosY.HasValue) + { + return; + } + + Pen pen = new(Color.Black); + Brush additionalBrush = new SolidBrush(EntityExcavator.AdditionalColor); + Brush bodybrush = new SolidBrush(EntityExcavator.BodyColor); + + //границы экскаватора + g.DrawRectangle(pen, _startPosX.Value, _startPosY.Value + 20, 100, 30); + g.DrawRectangle(pen, _startPosX.Value+30, _startPosY.Value, 10,20); + g.DrawRectangle(pen, _startPosX.Value+80, _startPosY.Value, 20,20); + g.DrawArc(pen, _startPosX.Value, _startPosY.Value + 45, 30, 40, 130, 100); + g.DrawArc(pen, _startPosX.Value + 80, _startPosY.Value + 50, 30, 40, 285, 110); + g.DrawLine(pen, _startPosX.Value+5, _startPosY.Value + 80, _startPosX.Value + 109, _startPosY.Value + 80); + g.DrawEllipse(pen, _startPosX.Value+5, _startPosY.Value + 53, 25, 25); + g.DrawEllipse(pen, _startPosX.Value + 80, _startPosY.Value + 53, 25, 25); + g.DrawEllipse(pen, _startPosX.Value+30, _startPosY.Value + 69, 10, 10); + g.DrawEllipse(pen, _startPosX.Value+48, _startPosY.Value + 69, 10, 10); + g.DrawEllipse(pen, _startPosX.Value+65, _startPosY.Value + 69, 10, 10); + g.DrawEllipse(pen, _startPosX.Value+40, _startPosY.Value + 53, 7, 7); + g.DrawEllipse(pen, _startPosX.Value + 60, _startPosY.Value + 53, 7, 7); + + //заливка кабины и основного железа + Brush br = new SolidBrush(Color.Black); + g.FillRectangle(bodybrush, _startPosX.Value, _startPosY.Value + 20, 100, 30); + g.FillRectangle(bodybrush, _startPosX.Value+30, _startPosY.Value, 10, 20); + g.FillRectangle(bodybrush, _startPosX.Value+80, _startPosY.Value, 20, 20); + g.FillEllipse(br, _startPosX.Value + 5, _startPosY.Value + 53, 25, 25); + g.FillEllipse(br, _startPosX.Value + 80, _startPosY.Value + 53, 25, 25); + g.FillEllipse(br, _startPosX.Value + 30, _startPosY.Value + 69, 10, 10); + g.FillEllipse(br, _startPosX.Value + 48, _startPosY.Value + 69, 10, 10); + g.FillEllipse(br, _startPosX.Value + 65, _startPosY.Value + 69, 10, 10); + g.FillEllipse(br, _startPosX.Value + 40, _startPosY.Value + 53, 7, 7); + g.FillEllipse(br, _startPosX.Value + 60, _startPosY.Value + 53, 7, 7); + + //фары + Brush brfara = new SolidBrush(Color.Blue); + g.DrawRectangle(pen, _startPosX.Value, _startPosY.Value + 27, 10, 10); + g.FillRectangle(brfara, _startPosX.Value, _startPosY.Value + 27, 10, 10); + //окно + g.FillRectangle(brfara, _startPosX.Value + 85, _startPosY.Value + 10, 10, 10); + + + if (EntityExcavator.Bucket) + { + Point point1 = new Point(_startPosX.Value+100, _startPosY.Value); + Point point2 = new Point(_startPosX.Value+180, _startPosY.Value); + Point point4 = new Point(_startPosX.Value + 180, _startPosY.Value + 40); + Point point5 = new Point(_startPosX.Value + 170, _startPosY.Value + 60); + Point point6 = new Point(_startPosX.Value + 150, _startPosY.Value + 60); + Point point7 = new Point(_startPosX.Value + 140, _startPosY.Value + 40); + Point point8 = new Point(_startPosX.Value + 172, _startPosY.Value + 40); + Point point9 = new Point(_startPosX.Value + 172, _startPosY.Value + 10); + Point point10 = new Point(_startPosX.Value + 100, _startPosY.Value+10); + + Point[] Bucket = { point1, point2, point4, point5, point6, point7,point8,point9,point10}; + g.FillPolygon(additionalBrush, Bucket); + } + + if (EntityExcavator.Support) + { + Point point1 = new Point(_startPosX.Value+2, _startPosY.Value+50); + Point point2 = new Point(_startPosX.Value + 12, _startPosY.Value+80); + Point point3 = new Point(_startPosX.Value + 22, _startPosY.Value + 80); + Point point4 = new Point(_startPosX.Value + 12, _startPosY.Value+50); + Point[] Support = { point1, point2, point3, point4 }; + g.FillPolygon(additionalBrush, Support); + + } + + if (EntityExcavator.BulldozerDump) + { + Point point11 = new Point(_startPosX.Value + 100, _startPosY.Value+40); + Point point12= new Point(_startPosX.Value + 160, _startPosY.Value+80); + Point point13= new Point(_startPosX.Value + 130, _startPosY.Value + 80); + Point point14 = new Point(_startPosX.Value + 100, _startPosY.Value+50); + Point[] Dump = { point11, point12, point13, point14 }; + g.FillPolygon(additionalBrush, Dump); + } + + + + + } +} + diff --git a/WinFormsAppExcavator/WinFormsAppExcavator/EntityExcavator.cs b/WinFormsAppExcavator/WinFormsAppExcavator/EntityExcavator.cs new file mode 100644 index 0000000..3a16436 --- /dev/null +++ b/WinFormsAppExcavator/WinFormsAppExcavator/EntityExcavator.cs @@ -0,0 +1,70 @@ +namespace WinFormsAppExcavator; + +public class EntityExcavator +{ + /// + /// Скорость + /// + 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 Bucket { get; private set; } + + /// + /// Признак (опция) наличие опоры + /// + public bool Support { get; private set; } + + /// + /// Признак (опция) наличие бульдозерного отвала + /// + public bool BulldozerDump { get; private set; } + + /// + /// Шаг перемещения автомобиля + /// + public double Step => Speed * 100 / Weight; + + /// + /// Инициализация полей объекта-класса экскаватора + /// + /// Скорость + /// Вес автомобиля + /// Основной цвет + /// Дополнительный цвет + /// Признак наличия ковша + /// Признак наличия опоры + /// Признак наличия бульдозерного обвеса + + + public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool bucket, bool support, bool bulldozerDump) + { + Speed = speed; + Weight = weight; + BodyColor = bodyColor; + AdditionalColor = additionalColor; + Bucket = bucket; + Support = support; + BulldozerDump = bulldozerDump; + + } +} + + diff --git a/WinFormsAppExcavator/WinFormsAppExcavator/Form1.Designer.cs b/WinFormsAppExcavator/WinFormsAppExcavator/Form1.Designer.cs deleted file mode 100644 index bc711b3..0000000 --- a/WinFormsAppExcavator/WinFormsAppExcavator/Form1.Designer.cs +++ /dev/null @@ -1,39 +0,0 @@ -namespace WinFormsAppExcavator -{ - 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 - } -} diff --git a/WinFormsAppExcavator/WinFormsAppExcavator/Form1.cs b/WinFormsAppExcavator/WinFormsAppExcavator/Form1.cs deleted file mode 100644 index 8cef7bc..0000000 --- a/WinFormsAppExcavator/WinFormsAppExcavator/Form1.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace WinFormsAppExcavator -{ - public partial class Form1 : Form - { - public Form1() - { - InitializeComponent(); - } - } -} diff --git a/WinFormsAppExcavator/WinFormsAppExcavator/FormExcavator.Designer.cs b/WinFormsAppExcavator/WinFormsAppExcavator/FormExcavator.Designer.cs new file mode 100644 index 0000000..81e7e5a --- /dev/null +++ b/WinFormsAppExcavator/WinFormsAppExcavator/FormExcavator.Designer.cs @@ -0,0 +1,135 @@ + +namespace WinFormsAppExcavator +{ + partial class FormExcavator + { + /// + /// 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() + { + pictureBoxExcavator = new PictureBox(); + buttonCreat = new Button(); + buttonLeft = new Button(); + buttonRight = new Button(); + buttonDown = new Button(); + buttonUp = new Button(); + ((System.ComponentModel.ISupportInitialize)pictureBoxExcavator).BeginInit(); + SuspendLayout(); + // + // pictureBoxExcavator + // + pictureBoxExcavator.Dock = DockStyle.Fill; + pictureBoxExcavator.Location = new Point(0, 0); + pictureBoxExcavator.Name = "pictureBoxExcavator"; + pictureBoxExcavator.Size = new Size(898, 329); + pictureBoxExcavator.TabIndex = 0; + pictureBoxExcavator.TabStop = false; + // + // buttonCreat + // + buttonCreat.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; + buttonCreat.Location = new Point(12, 288); + buttonCreat.Name = "buttonCreat"; + buttonCreat.Size = new Size(94, 29); + buttonCreat.TabIndex = 1; + buttonCreat.Text = "Создать"; + buttonCreat.UseVisualStyleBackColor = true; + buttonCreat.Click += ButtonCreat_Click; + // + // buttonLeft + // + buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + buttonLeft.BackgroundImage = Properties.Resources.Left; + buttonLeft.BackgroundImageLayout = ImageLayout.Stretch; + buttonLeft.Location = new Point(767, 285); + buttonLeft.Name = "buttonLeft"; + buttonLeft.Size = new Size(35, 35); + buttonLeft.TabIndex = 2; + buttonLeft.UseVisualStyleBackColor = true; + buttonLeft.Click += ButtonMove_Click; + // + // buttonRight + // + buttonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + buttonRight.BackgroundImage = Properties.Resources.Right; + buttonRight.BackgroundImageLayout = ImageLayout.Stretch; + buttonRight.Location = new Point(849, 285); + buttonRight.Name = "buttonRight"; + buttonRight.Size = new Size(35, 35); + buttonRight.TabIndex = 3; + buttonRight.UseVisualStyleBackColor = true; + buttonRight.Click += ButtonMove_Click; + // + // buttonDown + // + buttonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + buttonDown.BackgroundImage = Properties.Resources.Down; + buttonDown.BackgroundImageLayout = ImageLayout.Stretch; + buttonDown.Location = new Point(808, 285); + buttonDown.Name = "buttonDown"; + buttonDown.Size = new Size(35, 35); + buttonDown.TabIndex = 4; + buttonDown.UseVisualStyleBackColor = true; + buttonDown.Click += ButtonMove_Click; + // + // buttonUp + // + buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + buttonUp.BackgroundImage = Properties.Resources.Up; + buttonUp.BackgroundImageLayout = ImageLayout.Stretch; + buttonUp.Location = new Point(808, 244); + buttonUp.Name = "buttonUp"; + buttonUp.Size = new Size(35, 35); + buttonUp.TabIndex = 5; + buttonUp.UseVisualStyleBackColor = true; + buttonUp.Click += ButtonMove_Click; + // + // FormExcavator + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(898, 329); + Controls.Add(buttonUp); + Controls.Add(buttonDown); + Controls.Add(buttonRight); + Controls.Add(buttonLeft); + Controls.Add(buttonCreat); + Controls.Add(pictureBoxExcavator); + Name = "FormExcavator"; + Text = "Экскаватор"; + ((System.ComponentModel.ISupportInitialize)pictureBoxExcavator).EndInit(); + ResumeLayout(false); + } + + #endregion + + private PictureBox pictureBoxExcavator; + private Button buttonLeft; + private Button buttonRight; + private Button buttonDown; + private Button buttonUp; + public Button buttonCreat; + } +} \ No newline at end of file diff --git a/WinFormsAppExcavator/WinFormsAppExcavator/FormExcavator.cs b/WinFormsAppExcavator/WinFormsAppExcavator/FormExcavator.cs new file mode 100644 index 0000000..30c55b6 --- /dev/null +++ b/WinFormsAppExcavator/WinFormsAppExcavator/FormExcavator.cs @@ -0,0 +1,93 @@ +namespace WinFormsAppExcavator +{ + /// + /// форма с объектом Экскаватор + /// + public partial class FormExcavator : Form + { + /// + /// поле объект для прорисовки объекта + /// + private DrawingExcavator? _drawingExcavator; + + /// + /// Конструктор формы + /// + public FormExcavator() + { + InitializeComponent(); + } + + /// + /// метод прорисовки экскаватора + /// + + private void Draw() + { + if (_drawingExcavator == null) + { + return; + } + + Bitmap bmp = new(pictureBoxExcavator.Width, pictureBoxExcavator.Height); + Graphics gr = Graphics.FromImage(bmp); + _drawingExcavator.DrawTransport(gr); + pictureBoxExcavator.Image = bmp; + } + + /// + /// обработка кнопки создать + /// + /// + /// + private void ButtonCreat_Click(object sender, EventArgs e) + { + Random random = new(); + _drawingExcavator = new DrawingExcavator(); + _drawingExcavator.Init(random.Next(100, 300), random.Next(1000, 3000), + Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)), + Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)), + Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2))); + _drawingExcavator.SetPictureSize(pictureBoxExcavator.Width, pictureBoxExcavator.Height); + _drawingExcavator.SetPosition(random.Next(10, 100), random.Next(10, 100)); + + Draw(); + } + + /// + /// перемещение объекта + /// + /// + /// + private void ButtonMove_Click(object sender, EventArgs e) + { + if (_drawingExcavator == null) + { + return; + } + + string name = ((Button)sender)?.Name ?? string.Empty; + bool result = false; + switch (name) + { + case "buttonUp": + result = _drawingExcavator.MoveTransport(DirectionType.Up); + break; + case "buttonDown": + result = _drawingExcavator.MoveTransport(DirectionType.Down); + break; + case "buttonLeft": + result = _drawingExcavator.MoveTransport(DirectionType.Left); + break; + case "buttonRight": + result = _drawingExcavator.MoveTransport(DirectionType.Right); + break; + } + + if (result) + { + Draw(); + } + } + } +} diff --git a/WinFormsAppExcavator/WinFormsAppExcavator/Form1.resx b/WinFormsAppExcavator/WinFormsAppExcavator/FormExcavator.resx similarity index 93% rename from WinFormsAppExcavator/WinFormsAppExcavator/Form1.resx rename to WinFormsAppExcavator/WinFormsAppExcavator/FormExcavator.resx index 1af7de1..af32865 100644 --- a/WinFormsAppExcavator/WinFormsAppExcavator/Form1.resx +++ b/WinFormsAppExcavator/WinFormsAppExcavator/FormExcavator.resx @@ -1,17 +1,17 @@  - diff --git a/WinFormsAppExcavator/WinFormsAppExcavator/Program.cs b/WinFormsAppExcavator/WinFormsAppExcavator/Program.cs index 84c9bb5..9552f97 100644 --- a/WinFormsAppExcavator/WinFormsAppExcavator/Program.cs +++ b/WinFormsAppExcavator/WinFormsAppExcavator/Program.cs @@ -1,4 +1,4 @@ -namespace WinFormsAppExcavator +namespace WinFormsAppExcavator { internal static class Program { @@ -11,7 +11,7 @@ namespace WinFormsAppExcavator // To customize application configuration such as set high DPI settings or default font, // see https://aka.ms/applicationconfiguration. ApplicationConfiguration.Initialize(); - Application.Run(new Form1()); + Application.Run(new FormExcavator()); } } } \ No newline at end of file diff --git a/WinFormsAppExcavator/WinFormsAppExcavator/Properties/Resources.Designer.cs b/WinFormsAppExcavator/WinFormsAppExcavator/Properties/Resources.Designer.cs new file mode 100644 index 0000000..1af2022 --- /dev/null +++ b/WinFormsAppExcavator/WinFormsAppExcavator/Properties/Resources.Designer.cs @@ -0,0 +1,103 @@ +//------------------------------------------------------------------------------ +// +// Этот код создан программой. +// Исполняемая версия:4.0.30319.42000 +// +// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае +// повторной генерации кода. +// +//------------------------------------------------------------------------------ + +namespace WinFormsAppExcavator.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("WinFormsAppExcavator.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/WinFormsAppExcavator/WinFormsAppExcavator/Properties/Resources.resx b/WinFormsAppExcavator/WinFormsAppExcavator/Properties/Resources.resx new file mode 100644 index 0000000..fc8c15c --- /dev/null +++ b/WinFormsAppExcavator/WinFormsAppExcavator/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 + + + + ..\Resources\Down.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Left.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Right.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Up.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/WinFormsAppExcavator/WinFormsAppExcavator/Resources/Down.bmp b/WinFormsAppExcavator/WinFormsAppExcavator/Resources/Down.bmp new file mode 100644 index 0000000000000000000000000000000000000000..9a978c364226100001bb4f9bc0faffad18150427 GIT binary patch literal 989 zcmeAS@N?(olHy`uVBq!ia0vp^zkql*2OE&|dC~j@NHG=%xjQkeJ16rJ$YDu$^mSxl z*x1kgCy^D%=PdAuEM{O3Dgj}}duj3&3=GUgo-U3d6>)Fxoc6opAm9)<=l}n7rzM_E z0_zjslx=@+DZOWD=ytE18}s6A7^i=G{Y`j>!9wST3yKae1Qbd*1guy%WSLs{7@gV~ zunGVBcqHNWw!8bTrNmr&vWS06)sy;|hvgbV1hnBWZSV;vRM!>$el|7tc3yl>0#EcrSlotMPxbgn^ z*>kETeCnS*bN+4T(bpFI#eC$SX}$?NC=TSGB-Ng|ea88PjMI~1!C!nlrkjO-`5pN; zfBTI73pb~pc&_qARw8l8w*Zivqg(72&UdltQ7N%YRg7)E;BQjxqO_lH;d~#T z9)*&7sf@AR7t{@+LzMQ*fjppYcv`gd?0U}^!h(|Sf>!?{Os=bbIXOpk_KEerFNB3; ztA(w^yn)J0wd^LEgOZ=!#>MN`X5Ul%aA5LLhyH`NU(3!`W>-sc1v832Uj!5)G7F$2+8ukAFTdY=Q$1HIc^xn-GB9|$`njxg HN@xNAym5m- literal 0 HcmV?d00001 diff --git a/WinFormsAppExcavator/WinFormsAppExcavator/Resources/Left.png b/WinFormsAppExcavator/WinFormsAppExcavator/Resources/Left.png new file mode 100644 index 0000000000000000000000000000000000000000..f20b33ff1dc8275bb4a5f5d06fea1378b4aeacd8 GIT binary patch literal 1012 zcmeAS@N?(olHy`uVBq!ia0vp^zkql*2OE&|dC~j@NHG=%xjQkeJ16rJ$YDu$^mSxl z*x1kgCy^D%=PdAuEM{O3Dgj}}duj3&3=GVjo-U3d6>)FxM&~Vd5OKYD;q&}rsVNsW zS{-5hyec|f_oUE%u^jo^@& zuqv=AjeDW^<}HstNG}vuDu`44!nDSsnsaX=({l}{{3!=4CtZ+EK5E%~L0YNcoYEJz zh{AJfU!*zbtmgQu#`N6FY5xq-=X_54Cmh(>eL+9r=+4;}{8b8~6u(U7m@|#zZ$j7{ zG0wjZOv^)^>>EUvmpa{dd=O%|r{Avsro#hM)wp+$w^~Jf>0MKiyYji;3u%ryt6KIo zi7vNVXs=jMrT9gjW6nH|zxH8s$z1wlvJ^a>^&Y0W$8DI&V- zfTyV7E>ZQ^>kGMM>`J6}9eC(nzA(D*$GX)QSou!x;<(#&xOl0vxW$@avy#TcRZpF^ zKiUwx5-7J`6R5Afb{2o^gAMUF?H@OM1;*Sg{=3496ZQ*r+a1-bsEA#;{#{c0^(nu5 z^X?|@-c*0AQ}&v+^sghk4qGjCp3f;a@3qpGnKu$6!x#Fmv97ru`@;C(;putK^E+jk zoaRTAUvh1+6Si5o$Z3A(T$70)HJ(X8$+;{aLF~Q4znBkR)?TPDV7*uH7ylY-TftxY zEdKm0`zGC3>GMK5;`^_l^Y;z*6^6g-j;ihI2|l&>qm``AFTSQlTnpcu0Nod*{-wEN z?lfQ+Uz;1o`In_>xv7)=#2cBd7yQ%iW;R~XSE_iY@};|Tt~JMBwrg`&bN+Q}damV^ z-*Cfn_66z0yOxtLNGq3}Q~1IbS>C7irHymmVvfBG8#hnC(7oZ^8^te4Ea$ab;-=iV z>GYyickOO|hG{#vbxO{~CMdRCP;8(%Vq{=gz?z?5&)BW>sq#?uuD!sV%HZkh=d#Wz Gp$Pyt)Dba~4S(3a~i-`+s@Mn#0>x zDDI7U*XWq;_J!SG#c9zQ^DZbh3;?Pu-x>3-=jRTs`%3@I&m1<@RQ@kjT;O@?K)!pv zo`>YOy%#5+4rKeA@#S&W6hnQ<+8tu4N6z_t>OPsP0d$EIcL9FLC_ittoF4=Zr^y-a$ z7uG(l01{s#++JL(`!oMS?yN!}vFqdH3%RF0&b^TP>Z9Wev%dnnSaoM!(9P>?$(!h{ zT+$uKwQ%;{+%hNg-*?Wmd)DPen)&RB7tY$58$%4={$i=X zuA_RL5PJ>1)k?Y}tQOwB^0@gz?yZm0p{@kGx9j5!s2|F7)Jw9>=K%@hYr?y>O04g! zJoxJKjUUO>bFqC*{k-s40T>Qh#?yrJlL^;`CRI#rtIU?o>#<5uePb=PCK)y&?bgCvy)xf3`}% i;l-du276zB6@R&)cbe&BwjN-PWbkzLb6Mw<&;$TaVbG%h literal 0 HcmV?d00001 diff --git a/WinFormsAppExcavator/WinFormsAppExcavator/Resources/Up.png b/WinFormsAppExcavator/WinFormsAppExcavator/Resources/Up.png new file mode 100644 index 0000000000000000000000000000000000000000..14c6eab429ac45af9a43b58c67150f3e6ffe8340 GIT binary patch literal 1424 zcmeAS@N?(olHy`uVBq!ia0vp^zkql*2OE&|dC~j@NHG=%xjQkeJ16rJ$YDu$^mSxl z*x1kgCy^D%=PdAuEM{O3Dgj}}duj3&3=FKQo-U3d6>)Db2ji^Z>WXZ29>IzVXQNCA=tLaBgRou#!1&;UPmCAG<+`MZ?0wj98_EGVJrfYmVb(X-{V`J=;V1U*3)R)66Hb{kglrUN>K%_xsfi=DhsV-F{!*p#PR{Iva$Z zcI;Q)jmc^3-p+fK-ng%JUfLKZ`fc&m#!D9K`Km9zaLAky-o7`ZWQNJ9&_wxLGHSd< zsW+O{*gc(NWWOyqsd$OwJ=f>V!VZ%I)`xSXWE6PczcZN4c6#YWThV8i;&z(sSbiwx zmiDw`-%4h979YKILF$lAl=f7%YeLU1MlCd1x6PpY7}wH7(>BX3p=!LVOwTM_Ym^yq zHj&L&)YCbO-#BBHi`2y_7yP|dFEyyO=1FNyXfxI=xg5}FGN*Il^fI|=Y{r%)m(Da_ z3Ru?eH>)y0>J;C?{xG>oY@57aES}1~r0|W{u8b#)nG)7*a<_IwN*!6Zu-zPyJ^JgDD*9gQPm}xiy%@YVHF^Xc~m`r`2_w%h;keJ}dRdMWwz|HHL0zmr}rRBivgiYl(;9q&VByuogY{)JwEk1QTF;?hpMPb+cl4O z<$LjK+w*7dcq4sj@u})W-s!c@RUwu3G3P_;HEdVJh_8FP$bQPa;C0;Bi!RE0^lM&k zf4$>b_a*03y9#)x*92C%MT)O`I7#25U*q-R-!UIqUvj3_R?OGlr(nBq4gdS%qvA{5 zr<6XF(u-8E{c+@iw>9gf47IknTbdKxj19kB@@q7i1qxcOB^P~o_HGGQ=uJy{v2-p| zrirk#{#y}`#WN+UGM76@ogLLWjDl&3$KjbGyD~XQE3EL8Venable + + + True + True + Resources.resx + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + \ No newline at end of file -- 2.25.1 From 4a17242de7ba5cfd4a3ab3e22fd9f186336bd9bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D1=80=D0=B8=D1=8F=20=D0=9A=D0=BE=D1=82=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0?= Date: Wed, 14 Feb 2024 10:36:04 +0400 Subject: [PATCH 2/3] =?UTF-8?q?=D0=A1=D0=BE=D0=B7=D0=B4=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=20=D0=BF=D1=80=D0=BE=D0=B5=D0=BA=D1=82=D0=B0=20Difficult?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ExcavatorDifficult/ExcavatorDifficult.sln | 25 ++++ .../ExcavatorDifficult.csproj | 11 ++ .../ExcavatorDifficult/Form1.Designer.cs | 39 ++++++ .../ExcavatorDifficult/Form1.cs | 10 ++ .../ExcavatorDifficult/Form1.resx | 120 ++++++++++++++++++ .../ExcavatorDifficult/Program.cs | 17 +++ 6 files changed, 222 insertions(+) create mode 100644 ExcavatorDifficult/ExcavatorDifficult.sln create mode 100644 ExcavatorDifficult/ExcavatorDifficult/ExcavatorDifficult.csproj create mode 100644 ExcavatorDifficult/ExcavatorDifficult/Form1.Designer.cs create mode 100644 ExcavatorDifficult/ExcavatorDifficult/Form1.cs create mode 100644 ExcavatorDifficult/ExcavatorDifficult/Form1.resx create mode 100644 ExcavatorDifficult/ExcavatorDifficult/Program.cs diff --git a/ExcavatorDifficult/ExcavatorDifficult.sln b/ExcavatorDifficult/ExcavatorDifficult.sln new file mode 100644 index 0000000..50b5f3a --- /dev/null +++ b/ExcavatorDifficult/ExcavatorDifficult.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.8.34511.84 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExcavatorDifficult", "ExcavatorDifficult\ExcavatorDifficult.csproj", "{211B997C-88F3-497D-99BB-75E15A496217}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {211B997C-88F3-497D-99BB-75E15A496217}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {211B997C-88F3-497D-99BB-75E15A496217}.Debug|Any CPU.Build.0 = Debug|Any CPU + {211B997C-88F3-497D-99BB-75E15A496217}.Release|Any CPU.ActiveCfg = Release|Any CPU + {211B997C-88F3-497D-99BB-75E15A496217}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {3A9B8F79-81EB-4D27-B962-A6CA06C42421} + EndGlobalSection +EndGlobal diff --git a/ExcavatorDifficult/ExcavatorDifficult/ExcavatorDifficult.csproj b/ExcavatorDifficult/ExcavatorDifficult/ExcavatorDifficult.csproj new file mode 100644 index 0000000..663fdb8 --- /dev/null +++ b/ExcavatorDifficult/ExcavatorDifficult/ExcavatorDifficult.csproj @@ -0,0 +1,11 @@ + + + + WinExe + net8.0-windows + enable + true + enable + + + \ No newline at end of file diff --git a/ExcavatorDifficult/ExcavatorDifficult/Form1.Designer.cs b/ExcavatorDifficult/ExcavatorDifficult/Form1.Designer.cs new file mode 100644 index 0000000..62d6e38 --- /dev/null +++ b/ExcavatorDifficult/ExcavatorDifficult/Form1.Designer.cs @@ -0,0 +1,39 @@ +namespace ExcavatorDifficult +{ + 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 + } +} diff --git a/ExcavatorDifficult/ExcavatorDifficult/Form1.cs b/ExcavatorDifficult/ExcavatorDifficult/Form1.cs new file mode 100644 index 0000000..0f16e60 --- /dev/null +++ b/ExcavatorDifficult/ExcavatorDifficult/Form1.cs @@ -0,0 +1,10 @@ +namespace ExcavatorDifficult +{ + public partial class Form1 : Form + { + public Form1() + { + InitializeComponent(); + } + } +} diff --git a/ExcavatorDifficult/ExcavatorDifficult/Form1.resx b/ExcavatorDifficult/ExcavatorDifficult/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ExcavatorDifficult/ExcavatorDifficult/Form1.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/ExcavatorDifficult/ExcavatorDifficult/Program.cs b/ExcavatorDifficult/ExcavatorDifficult/Program.cs new file mode 100644 index 0000000..dbca9b6 --- /dev/null +++ b/ExcavatorDifficult/ExcavatorDifficult/Program.cs @@ -0,0 +1,17 @@ +namespace ExcavatorDifficult +{ + 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 Form1()); + } + } +} \ No newline at end of file -- 2.25.1 From 9e4beecdc6ee7a919a4d32346b61aa0b36642ab8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D1=80=D0=B8=D1=8F=20=D0=9A=D0=BE=D1=82=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0?= Date: Wed, 14 Feb 2024 16:58:47 +0400 Subject: [PATCH 3/3] =?UTF-8?q?=D0=9B=D0=B0=D0=B1=D0=BE=D1=80=D0=B0=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=BD=D0=B0=D1=8F=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=B0=20=E2=84=961?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WinFormsAppExcavator/DrawingExcavator.cs | 34 ++++++++++++++----- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/WinFormsAppExcavator/WinFormsAppExcavator/DrawingExcavator.cs b/WinFormsAppExcavator/WinFormsAppExcavator/DrawingExcavator.cs index 6d69187..3012094 100644 --- a/WinFormsAppExcavator/WinFormsAppExcavator/DrawingExcavator.cs +++ b/WinFormsAppExcavator/WinFormsAppExcavator/DrawingExcavator.cs @@ -33,7 +33,7 @@ public class DrawingExcavator /// /// Ширина прорисовки экскаватора /// - private readonly int _drawningExcavatorWidth = 175; + private readonly int _drawningExcavatorWidth = 174; /// /// Высота прорисовки экскаватора @@ -69,15 +69,26 @@ public class DrawingExcavator /// true - границы заданы, false - проверка не пройдена, нельзя разместить объект в этих размерах public bool SetPictureSize(int width, int height) { - + if (_drawningExcavatorWidth < width && _drawningExcavatorHeight < height) { _pictureWidth = width; _pictureHeight = height; + if (_startPosX.HasValue && _startPosY.HasValue) + { + if (_startPosX+_drawningExcavatorWidth>=_pictureWidth + || _startPosY+_drawningExcavatorHeight>=_pictureHeight) + { + _startPosX = 0; + _startPosY = 0; + } + + } return true; - } - else { return false; } - } + } + + return false; + } /// /// Установка позиции @@ -90,16 +101,21 @@ public class DrawingExcavator { return; } - if (x > 0 && y > 0 && x + _drawningExcavatorWidth < _pictureWidth && _drawningExcavatorHeight + y < _pictureHeight) + if (x + _drawningExcavatorWidth < _pictureWidth && _drawningExcavatorHeight + y < _pictureHeight && x>0 && y>0) { _startPosX = x; _startPosY = y; } - else + if (x + _drawningExcavatorWidth >_pictureWidth || x < 0) { - _startPosX = 10; - _startPosY = 10; + _startPosX = 0; + } + if (y+_drawningExcavatorHeight > _pictureHeight || y < 0) + { + _startPosY = 0; + } + } /// -- 2.25.1