From 0caa128262b75525613699ddcc5997f7e560ad6e Mon Sep 17 00:00:00 2001 From: aleyckin Date: Wed, 7 Sep 2022 11:26:07 +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=20=E2=84=961(=D1=82=D0=BE,=20=D1=87=D1=82=D0=BE=20=D1=83?= =?UTF-8?q?=D1=81=D0=BF=D0=B5=D0=BB=20=D1=81=D0=B4=D0=B5=D0=BB=D0=B0=D1=82?= =?UTF-8?q?=D1=8C=20=D0=B7=D0=B0=20=D0=BB=D0=B0=D0=B1=D1=8B)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AirBomber/AirBomber/AirBomber.csproj | 15 ++ AirBomber/AirBomber/Direction.cs | 16 ++ AirBomber/AirBomber/DrawningBomber.cs | 116 ++++++++++++ AirBomber/AirBomber/EntityAirBomber.cs | 24 +++ AirBomber/AirBomber/Form1.Designer.cs | 39 ---- AirBomber/AirBomber/FormAirBomber.Designer.cs | 167 ++++++++++++++++++ .../AirBomber/{Form1.cs => FormAirBomber.cs} | 4 +- AirBomber/AirBomber/FormAirBomber.resx | 63 +++++++ AirBomber/AirBomber/Program.cs | 2 +- .../Properties/Resources.Designer.cs | 103 +++++++++++ .../{Form1.resx => Properties/Resources.resx} | 13 ++ AirBomber/AirBomber/Resources/ArrowDown.png | Bin 0 -> 1322 bytes AirBomber/AirBomber/Resources/ArrowLeft.png | Bin 0 -> 1220 bytes AirBomber/AirBomber/Resources/ArrowRight.png | Bin 0 -> 1153 bytes AirBomber/AirBomber/Resources/ArrowUp.png | Bin 0 -> 1324 bytes Images/ArrowDown.png | Bin 0 -> 1322 bytes Images/ArrowLeft.png | Bin 0 -> 1220 bytes Images/ArrowRight.png | Bin 0 -> 1153 bytes Images/ArrowUp.png | Bin 0 -> 1324 bytes 19 files changed, 520 insertions(+), 42 deletions(-) create mode 100644 AirBomber/AirBomber/Direction.cs create mode 100644 AirBomber/AirBomber/DrawningBomber.cs create mode 100644 AirBomber/AirBomber/EntityAirBomber.cs delete mode 100644 AirBomber/AirBomber/Form1.Designer.cs create mode 100644 AirBomber/AirBomber/FormAirBomber.Designer.cs rename AirBomber/AirBomber/{Form1.cs => FormAirBomber.cs} (53%) create mode 100644 AirBomber/AirBomber/FormAirBomber.resx create mode 100644 AirBomber/AirBomber/Properties/Resources.Designer.cs rename AirBomber/AirBomber/{Form1.resx => Properties/Resources.resx} (83%) create mode 100644 AirBomber/AirBomber/Resources/ArrowDown.png create mode 100644 AirBomber/AirBomber/Resources/ArrowLeft.png create mode 100644 AirBomber/AirBomber/Resources/ArrowRight.png create mode 100644 AirBomber/AirBomber/Resources/ArrowUp.png create mode 100644 Images/ArrowDown.png create mode 100644 Images/ArrowLeft.png create mode 100644 Images/ArrowRight.png create mode 100644 Images/ArrowUp.png diff --git a/AirBomber/AirBomber/AirBomber.csproj b/AirBomber/AirBomber/AirBomber.csproj index b57c89e..13ee123 100644 --- a/AirBomber/AirBomber/AirBomber.csproj +++ b/AirBomber/AirBomber/AirBomber.csproj @@ -8,4 +8,19 @@ enable + + + True + True + Resources.resx + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + \ No newline at end of file diff --git a/AirBomber/AirBomber/Direction.cs b/AirBomber/AirBomber/Direction.cs new file mode 100644 index 0000000..306144d --- /dev/null +++ b/AirBomber/AirBomber/Direction.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AirBomber +{ + internal enum Direction + { + Up = 1, + Down = 2, + Left = 3, + Right = 4 + } +} diff --git a/AirBomber/AirBomber/DrawningBomber.cs b/AirBomber/AirBomber/DrawningBomber.cs new file mode 100644 index 0000000..af6f013 --- /dev/null +++ b/AirBomber/AirBomber/DrawningBomber.cs @@ -0,0 +1,116 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AirBomber +{ + internal class DrawningBomber + { + public EntityAirBomber AirBomber { private set; get; } + private float _startPosX; + private float _startPosY; + private int? _pictureWidth = null; + private int? _pictureHeight = null; + private readonly int _airBomberWidth = 100; + private readonly int _airBomberHeight = 100; + + public void Init(int speed, float weight, Color bodyColor) + { + AirBomber = new EntityAirBomber(); + AirBomber.Init(speed, weight, bodyColor); + } + + public void SetPosition(int x, int y, int width, int height) + { + if (x > _pictureWidth || x < 0) return; + else _startPosX = x; + if (y > _pictureHeight || y < 0) return; + else _startPosY = y; + _pictureWidth = width; + _pictureHeight = height; + } + + public void MoveTransport(Direction direction) + { + if (!_pictureWidth.HasValue || !_pictureHeight.HasValue) + { + return; + } + switch (direction) + { + case Direction.Right: + if (_startPosX + _airBomberWidth + AirBomber.Step < _pictureWidth) + { + _startPosX += AirBomber.Step; + } + break; + case Direction.Left: + if (_startPosX - AirBomber.Step > 0) + { + _startPosX -= AirBomber.Step; + } + break; + case Direction.Up: + if (_startPosY - AirBomber.Step > 0) + { + _startPosY -= AirBomber.Step; + } + break; + case Direction.Down: + if (_startPosY + _airBomberHeight + AirBomber.Step < _pictureHeight) + { + _startPosY += AirBomber.Step; + } + break; + } + } + + public void DrawTransport(Graphics g) + { + if (_startPosX < 0 || _startPosY < 0 || !_pictureHeight.HasValue || !_pictureWidth.HasValue) + { + return; + } + + Pen pen = new(Color.Black); + SolidBrush brush = new SolidBrush(AirBomber?.BodyColor ?? Color.Cyan); + + g.FillPolygon(brush, new[] { + new Point((int)(_startPosX + _airBomberWidth), (int)(_startPosY + _airBomberHeight / 2 - 20)), + new Point((int)(_startPosX + _airBomberWidth), (int)(_startPosY + _airBomberHeight / 2 + 20)), + new Point((int)(_startPosX + _airBomberWidth - 10), (int)(_startPosY + _airBomberHeight / 2 + 10)), + new Point((int)(_startPosX + _airBomberWidth - 10), (int)(_startPosY + _airBomberHeight / 2 - 10)) + }); + + g.FillPolygon(brush, new[] { + new Point((int)(_startPosX + _airBomberWidth / 2), (int)(_startPosY)), + new Point((int)(_startPosX + _airBomberWidth / 2 + 10), (int)(_startPosY)), + new Point((int)(_startPosX + _airBomberWidth / 2 + 20), (int)(_startPosY + _airBomberHeight / 2)), + new Point((int)(_startPosX + _airBomberWidth / 2 + 10), (int)(_startPosY + _airBomberHeight)), + new Point((int)(_startPosX + _airBomberWidth / 2), (int)(_startPosY + _airBomberHeight)) + }); + } + + public void ChangeBorders(int width, int height) + { + _pictureWidth = width; + _pictureHeight = height; + if (_pictureWidth <= _airBomberWidth || _pictureHeight <= _airBomberHeight) + { + _pictureWidth = null; + _pictureHeight = null; + return; + } + if (_startPosX + _airBomberWidth > _pictureWidth) + { + _startPosX = _pictureWidth.Value - _airBomberWidth; + } + if (_startPosY + _airBomberHeight > _pictureHeight) + { + _startPosY = _pictureHeight.Value - _airBomberHeight; + } + } + } +} diff --git a/AirBomber/AirBomber/EntityAirBomber.cs b/AirBomber/AirBomber/EntityAirBomber.cs new file mode 100644 index 0000000..86c87af --- /dev/null +++ b/AirBomber/AirBomber/EntityAirBomber.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AirBomber +{ + internal class EntityAirBomber + { + public int Speed { get; private set; } + public float Weight { get; private set; } + public Color BodyColor { get; private set; } + public float Step => Speed * 100 / Weight; + + public void Init(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/AirBomber/AirBomber/Form1.Designer.cs b/AirBomber/AirBomber/Form1.Designer.cs deleted file mode 100644 index 185eea6..0000000 --- a/AirBomber/AirBomber/Form1.Designer.cs +++ /dev/null @@ -1,39 +0,0 @@ -namespace AirBomber -{ - 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 diff --git a/AirBomber/AirBomber/FormAirBomber.Designer.cs b/AirBomber/AirBomber/FormAirBomber.Designer.cs new file mode 100644 index 0000000..38dd70b --- /dev/null +++ b/AirBomber/AirBomber/FormAirBomber.Designer.cs @@ -0,0 +1,167 @@ +namespace AirBomber +{ + partial class FormAirBomber + { + /// + /// 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.pictureBoxAirBomber = new System.Windows.Forms.PictureBox(); + this.statusStrip = 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.buttonCreate = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + this.button3 = new System.Windows.Forms.Button(); + this.button4 = new System.Windows.Forms.Button(); + this.button5 = new System.Windows.Forms.Button(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBoxAirBomber)).BeginInit(); + this.statusStrip.SuspendLayout(); + this.SuspendLayout(); + // + // pictureBoxAirBomber + // + this.pictureBoxAirBomber.Dock = System.Windows.Forms.DockStyle.Fill; + this.pictureBoxAirBomber.Location = new System.Drawing.Point(0, 0); + this.pictureBoxAirBomber.Name = "pictureBoxAirBomber"; + this.pictureBoxAirBomber.Size = new System.Drawing.Size(800, 450); + this.pictureBoxAirBomber.TabIndex = 0; + this.pictureBoxAirBomber.TabStop = false; + // + // statusStrip + // + this.statusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripStatusLabelSpeed, + this.toolStripStatusLabelWeight, + this.toolStripStatusLabelBodyColor}); + this.statusStrip.Location = new System.Drawing.Point(0, 428); + this.statusStrip.Name = "statusStrip"; + this.statusStrip.Size = new System.Drawing.Size(800, 22); + this.statusStrip.TabIndex = 1; + // + // toolStripStatusLabelSpeed + // + this.toolStripStatusLabelSpeed.Name = "toolStripStatusLabelSpeed"; + this.toolStripStatusLabelSpeed.Size = new System.Drawing.Size(62, 17); + this.toolStripStatusLabelSpeed.Text = "Скорость:"; + // + // toolStripStatusLabelWeight + // + this.toolStripStatusLabelWeight.Name = "toolStripStatusLabelWeight"; + this.toolStripStatusLabelWeight.Size = new System.Drawing.Size(29, 17); + this.toolStripStatusLabelWeight.Text = "Вес:"; + // + // toolStripStatusLabelBodyColor + // + this.toolStripStatusLabelBodyColor.Name = "toolStripStatusLabelBodyColor"; + this.toolStripStatusLabelBodyColor.Size = new System.Drawing.Size(36, 17); + this.toolStripStatusLabelBodyColor.Text = "Цвет:"; + // + // buttonCreate + // + this.buttonCreate.Location = new System.Drawing.Point(12, 390); + this.buttonCreate.Name = "buttonCreate"; + this.buttonCreate.Size = new System.Drawing.Size(79, 35); + this.buttonCreate.TabIndex = 2; + this.buttonCreate.Text = "Создать"; + this.buttonCreate.UseVisualStyleBackColor = true; + // + // button2 + // + this.button2.BackgroundImage = global::AirBomber.Properties.Resources.ArrowUp; + this.button2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; + this.button2.Location = new System.Drawing.Point(722, 367); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(30, 30); + this.button2.TabIndex = 3; + this.button2.UseVisualStyleBackColor = true; + // + // button3 + // + this.button3.BackgroundImage = global::AirBomber.Properties.Resources.ArrowLeft; + this.button3.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; + this.button3.Location = new System.Drawing.Point(686, 403); + this.button3.Name = "button3"; + this.button3.Size = new System.Drawing.Size(30, 30); + this.button3.TabIndex = 4; + this.button3.UseVisualStyleBackColor = true; + // + // button4 + // + this.button4.BackgroundImage = global::AirBomber.Properties.Resources.ArrowDown; + this.button4.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; + this.button4.Location = new System.Drawing.Point(722, 403); + this.button4.Name = "button4"; + this.button4.Size = new System.Drawing.Size(30, 30); + this.button4.TabIndex = 5; + this.button4.UseVisualStyleBackColor = true; + // + // button5 + // + this.button5.BackgroundImage = global::AirBomber.Properties.Resources.ArrowRight; + this.button5.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; + this.button5.Location = new System.Drawing.Point(758, 403); + this.button5.Name = "button5"; + this.button5.Size = new System.Drawing.Size(30, 30); + this.button5.TabIndex = 6; + this.button5.UseVisualStyleBackColor = true; + // + // FormAirBomber + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Controls.Add(this.button5); + this.Controls.Add(this.button4); + this.Controls.Add(this.button3); + this.Controls.Add(this.button2); + this.Controls.Add(this.buttonCreate); + this.Controls.Add(this.statusStrip); + this.Controls.Add(this.pictureBoxAirBomber); + this.Name = "FormAirBomber"; + this.Text = "Бомбардировщик"; + ((System.ComponentModel.ISupportInitialize)(this.pictureBoxAirBomber)).EndInit(); + this.statusStrip.ResumeLayout(false); + this.statusStrip.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private PictureBox pictureBoxAirBomber; + private StatusStrip statusStrip; + private ToolStripStatusLabel toolStripStatusLabelSpeed; + private ToolStripStatusLabel toolStripStatusLabelWeight; + private ToolStripStatusLabel toolStripStatusLabelBodyColor; + private Button buttonCreate; + private Button button2; + private Button button3; + private Button button4; + private Button button5; + } +} \ No newline at end of file diff --git a/AirBomber/AirBomber/Form1.cs b/AirBomber/AirBomber/FormAirBomber.cs similarity index 53% rename from AirBomber/AirBomber/Form1.cs rename to AirBomber/AirBomber/FormAirBomber.cs index 0ca8021..e998b26 100644 --- a/AirBomber/AirBomber/Form1.cs +++ b/AirBomber/AirBomber/FormAirBomber.cs @@ -1,8 +1,8 @@ namespace AirBomber { - public partial class Form1 : Form + public partial class FormAirBomber : Form { - public Form1() + public FormAirBomber() { InitializeComponent(); } diff --git a/AirBomber/AirBomber/FormAirBomber.resx b/AirBomber/AirBomber/FormAirBomber.resx new file mode 100644 index 0000000..2c0949d --- /dev/null +++ b/AirBomber/AirBomber/FormAirBomber.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/AirBomber/AirBomber/Program.cs b/AirBomber/AirBomber/Program.cs index 34d9512..76b85fe 100644 --- a/AirBomber/AirBomber/Program.cs +++ b/AirBomber/AirBomber/Program.cs @@ -11,7 +11,7 @@ namespace AirBomber // 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 FormAirBomber()); } } } \ No newline at end of file diff --git a/AirBomber/AirBomber/Properties/Resources.Designer.cs b/AirBomber/AirBomber/Properties/Resources.Designer.cs new file mode 100644 index 0000000..6a4bdb7 --- /dev/null +++ b/AirBomber/AirBomber/Properties/Resources.Designer.cs @@ -0,0 +1,103 @@ +//------------------------------------------------------------------------------ +// +// Этот код создан программой. +// Исполняемая версия:4.0.30319.42000 +// +// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае +// повторной генерации кода. +// +//------------------------------------------------------------------------------ + +namespace AirBomber.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("AirBomber.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 ArrowDown { + get { + object obj = ResourceManager.GetObject("ArrowDown", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap ArrowLeft { + get { + object obj = ResourceManager.GetObject("ArrowLeft", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap ArrowRight { + get { + object obj = ResourceManager.GetObject("ArrowRight", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap ArrowUp { + get { + object obj = ResourceManager.GetObject("ArrowUp", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + } +} diff --git a/AirBomber/AirBomber/Form1.resx b/AirBomber/AirBomber/Properties/Resources.resx similarity index 83% rename from AirBomber/AirBomber/Form1.resx rename to AirBomber/AirBomber/Properties/Resources.resx index 1af7de1..1ee1a77 100644 --- a/AirBomber/AirBomber/Form1.resx +++ b/AirBomber/AirBomber/Properties/Resources.resx @@ -117,4 +117,17 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\ArrowDown.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\ArrowLeft.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\ArrowRight.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\ArrowUp.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/AirBomber/AirBomber/Resources/ArrowDown.png b/AirBomber/AirBomber/Resources/ArrowDown.png new file mode 100644 index 0000000000000000000000000000000000000000..88a8477618090349b7b9740755e58c67403ff071 GIT binary patch literal 1322 zcmd5+`&W_&7{>AvgykiT5NoFzmPgGnqlwx&SEeakw}EY;plX_ zy}dn?$?WXxEG;dKiHRvJETm8<0RaKQ!NGdHUMv=~*=$cw >?l}hF0Evb(Uk%a>&z6|8oHWC+{UNtbw_Ly8It=Mo?=-U2+ovK(3teSIiL# z`>up~-7<1nDCbA(4!xg4>-rv8r_$raU z8I5I@z^%gHARQ3`)fVg~@2fuHyJ$ft1d)GSQhHy#2(L{IvT*e4zqAI+EdJju+IdWG z8dlo9i}E|>LFnI6Y@Jh*{x2#mbDfWe-=QY*?2BWgg>`%VE*6DJJ0E6)xUK5}YUNo| z(UNmQ&$KVbB`d4_Id1s0+t*8rbH-QQ^M1?1i$yDo?9%a1RHZezX6 z-N89c6*16}1)Lf)zuzl#Eiza-Tg#ObAZO}h))Q`4XG=t*gHEKR~?=kPIy zIMHjwox2SaPI$rf>$V!vwU#y9_z93%c>ZA53zo!6i=ku)|OT@uL0{JomY~ zlp86R4(()-OJ}IqTc^y@#?v-cN0CGMyuZIgC157}X}9+y(O{2(wEZ)`Ie$d`GfT%v zNUyM}7F|oPqQtszCfxbE7Jzu4kx@aij**=1AaRw|6Yi~TZNkkH;NQfeWo_bl1Yvcf z8x`BE1tw#K4J@5(;H@dD%W%GDF)2@>ojE!q_^nL4D9I*|KeFu^I^A zv^NZKwJ$}v8-3BTF?aq)4o`c!igFIm2DjNPbm@3{_=Ds!&NNiw0?VuvBay>AldYG8 z8ubF$qhGV?v;gS7-*CU(plHH*@5(UmZ3&N70gWg$$;dqzQAO!UC?waToGBWv>}g&_ z@@+Jy)tyh@w`%>XrsYkKj&U|a@)O(vlghM6AvMa|z}+ZPZPt(G0;l(3Xm| zcLCow;V!EH*P~^UxkTM^wr@wvpF1ju4P#nvamwm&VmqgKV$}1m+B)U6+A@}}AR;U7 hLrv{JpPsq7abVJ literal 0 HcmV?d00001 diff --git a/AirBomber/AirBomber/Resources/ArrowLeft.png b/AirBomber/AirBomber/Resources/ArrowLeft.png new file mode 100644 index 0000000000000000000000000000000000000000..8053c8035a3116785dd8901e2be4e1d8b31abb5b GIT binary patch literal 1220 zcmV;#1UvhQP)Px#1ZP1_K>z@;j|==^1poj5Z%|BBMgRZ*0001)nVHAO$B~hd`T6pI-bqA3RCr$P-RpLuFcbygj23CZ*0#3xe$nasKjVOI5lsRKxVm!A?C%%# z!g4Q7kB0;_L_|bHL_|bHL_|bHL_|bHL_|bH=~}NQ#p()wC{#TB*;#IIi!S92^3}d_ z+^WbYvcdNPx2y4pWR05)_vkQde?s9E_o;A=P{*!uuL2i{bVALWm|r51WrjxxSN=sF zn~u_dQY4Pt;W46FMWXEj4-#zgjVx~R6J8;SkNAY1B5@!*VfKt1ezFsm`%bBY=!6AA zbdsE~vq&`LCS2SjLJzSC-JOJk)P%i7q9HS3=ItbGA`_N)@j)ae?CKMhnNE~}fc0zwd zkvQ>OTu*=5CSd9^zLQAIyk~qo;c=2(cD#}KkWL~&-nVglkw}H7SPkqXlJtR0N9MRw zg)f9^ajkBW%&Nv?I*B9|2)3u8NE|!v!aqiK5-Ivdwyp9Ox2l40HBCjL1?kS#Nu&q) z)D?*X1XNcf4t4?c6^Vm7U(Cd{JXOH_4cj_Z316|PlreYM(#mAmP)l>2*wNMRx)`QSV7ZcuiP12{|P3eRMWAB=PCDOqDz>|5V^(=&1~ zuCbexjT($g>?Cm$yxaj2Kd-AXczWtq%w<|<16NH6`Hj%H|go=92^{?qM|Y~ zGGt_A5fKq|bac13w~LF5Q&UrUd3i}mNj*J1LqkLG@bIgvtA2idEiEnH-rmsA&=nOG zUteF_mN>5f00YfQL_t(|obBD|QsPh$1z?*Pg6t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Em2ZYBN&^; zmT3onrh44TVOiW${B6=nl`(-i%rkH47Ptay1e!v&z8&QYg1P?vPa+PxOxIiCA^FbW zwT0JMqjVDpNwx%>Km%fSQLpGW`Zl~!g_)WEIao@(a)6l&Bg%b_4&_iPYgbH1lbZ~( z`vPPahv&$(ixihu@b#$rY39&8lu2g~ie&`%{_jpG$ck*4)FBW4h!T~p7i16rXtQQU}ZtWo1nL+RS0>;ya`Aey_4uR8xsBZD# z2ud^SgT)>Eic%EJ(r3l%@c+ExwO*RZWKfs6GL(ozpME}U_9x_UdYwH^&ByK zII3N&UA~1W!EQ=SZT|#!YVm(>wpRC%Et?#{csjf0pF+aLO$=mt+Bf<)UOG<|hONKpjwq;bOD2)Z>pWJg?lz=}rIYXv79yHOLav2A(8wd5mLSjOE+~_qT~RDAf7hWD`SZTqzwkoyW)OZ}L7r{y(bxV1dNZ%X literal 0 HcmV?d00001 diff --git a/Images/ArrowDown.png b/Images/ArrowDown.png new file mode 100644 index 0000000000000000000000000000000000000000..88a8477618090349b7b9740755e58c67403ff071 GIT binary patch literal 1322 zcmd5+`&W_&7{>AvgykiT5NoFzmPgGnqlwx&SEeakw}EY;plX_ zy}dn?$?WXxEG;dKiHRvJETm8<0RaKQ!NGdHUMv=~*=$cw >?l}hF0Evb(Uk%a>&z6|8oHWC+{UNtbw_Ly8It=Mo?=-U2+ovK(3teSIiL# z`>up~-7<1nDCbA(4!xg4>-rv8r_$raU z8I5I@z^%gHARQ3`)fVg~@2fuHyJ$ft1d)GSQhHy#2(L{IvT*e4zqAI+EdJju+IdWG z8dlo9i}E|>LFnI6Y@Jh*{x2#mbDfWe-=QY*?2BWgg>`%VE*6DJJ0E6)xUK5}YUNo| z(UNmQ&$KVbB`d4_Id1s0+t*8rbH-QQ^M1?1i$yDo?9%a1RHZezX6 z-N89c6*16}1)Lf)zuzl#Eiza-Tg#ObAZO}h))Q`4XG=t*gHEKR~?=kPIy zIMHjwox2SaPI$rf>$V!vwU#y9_z93%c>ZA53zo!6i=ku)|OT@uL0{JomY~ zlp86R4(()-OJ}IqTc^y@#?v-cN0CGMyuZIgC157}X}9+y(O{2(wEZ)`Ie$d`GfT%v zNUyM}7F|oPqQtszCfxbE7Jzu4kx@aij**=1AaRw|6Yi~TZNkkH;NQfeWo_bl1Yvcf z8x`BE1tw#K4J@5(;H@dD%W%GDF)2@>ojE!q_^nL4D9I*|KeFu^I^A zv^NZKwJ$}v8-3BTF?aq)4o`c!igFIm2DjNPbm@3{_=Ds!&NNiw0?VuvBay>AldYG8 z8ubF$qhGV?v;gS7-*CU(plHH*@5(UmZ3&N70gWg$$;dqzQAO!UC?waToGBWv>}g&_ z@@+Jy)tyh@w`%>XrsYkKj&U|a@)O(vlghM6AvMa|z}+ZPZPt(G0;l(3Xm| zcLCow;V!EH*P~^UxkTM^wr@wvpF1ju4P#nvamwm&VmqgKV$}1m+B)U6+A@}}AR;U7 hLrv{JpPsq7abVJ literal 0 HcmV?d00001 diff --git a/Images/ArrowLeft.png b/Images/ArrowLeft.png new file mode 100644 index 0000000000000000000000000000000000000000..8053c8035a3116785dd8901e2be4e1d8b31abb5b GIT binary patch literal 1220 zcmV;#1UvhQP)Px#1ZP1_K>z@;j|==^1poj5Z%|BBMgRZ*0001)nVHAO$B~hd`T6pI-bqA3RCr$P-RpLuFcbygj23CZ*0#3xe$nasKjVOI5lsRKxVm!A?C%%# z!g4Q7kB0;_L_|bHL_|bHL_|bHL_|bHL_|bH=~}NQ#p()wC{#TB*;#IIi!S92^3}d_ z+^WbYvcdNPx2y4pWR05)_vkQde?s9E_o;A=P{*!uuL2i{bVALWm|r51WrjxxSN=sF zn~u_dQY4Pt;W46FMWXEj4-#zgjVx~R6J8;SkNAY1B5@!*VfKt1ezFsm`%bBY=!6AA zbdsE~vq&`LCS2SjLJzSC-JOJk)P%i7q9HS3=ItbGA`_N)@j)ae?CKMhnNE~}fc0zwd zkvQ>OTu*=5CSd9^zLQAIyk~qo;c=2(cD#}KkWL~&-nVglkw}H7SPkqXl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=D1=80=D0=B2=D0=B0=D1=8F=20?= =?UTF-8?q?=D0=BB=D0=B0=D0=B1=D0=BE=D1=80=D0=B0=D1=82=D0=BE=D1=80=D0=BD?= =?UTF-8?q?=D0=B0=D1=8F=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AirBomber/AirBomber/DrawningBomber.cs | 17 ++- AirBomber/AirBomber/FormAirBomber.Designer.cs | 109 ++++++++++-------- AirBomber/AirBomber/FormAirBomber.cs | 48 ++++++++ 3 files changed, 123 insertions(+), 51 deletions(-) diff --git a/AirBomber/AirBomber/DrawningBomber.cs b/AirBomber/AirBomber/DrawningBomber.cs index af6f013..1643a4f 100644 --- a/AirBomber/AirBomber/DrawningBomber.cs +++ b/AirBomber/AirBomber/DrawningBomber.cs @@ -74,11 +74,10 @@ namespace AirBomber return; } - Pen pen = new(Color.Black); SolidBrush brush = new SolidBrush(AirBomber?.BodyColor ?? Color.Cyan); g.FillPolygon(brush, new[] { - new Point((int)(_startPosX + _airBomberWidth), (int)(_startPosY + _airBomberHeight / 2 - 20)), + new Point((int)(_startPosX + _airBomberWidth), (int)(_startPosY + _airBomberHeight / 2 - 20)), new Point((int)(_startPosX + _airBomberWidth), (int)(_startPosY + _airBomberHeight / 2 + 20)), new Point((int)(_startPosX + _airBomberWidth - 10), (int)(_startPosY + _airBomberHeight / 2 + 10)), new Point((int)(_startPosX + _airBomberWidth - 10), (int)(_startPosY + _airBomberHeight / 2 - 10)) @@ -91,6 +90,20 @@ namespace AirBomber new Point((int)(_startPosX + _airBomberWidth / 2 + 10), (int)(_startPosY + _airBomberHeight)), new Point((int)(_startPosX + _airBomberWidth / 2), (int)(_startPosY + _airBomberHeight)) }); + + g.FillPolygon(brush, new[] { + new Point((int)(_startPosX + 20), (int)(_startPosY + _airBomberHeight / 2 - 5)), + new Point((int)(_startPosX + _airBomberWidth), (int)(_startPosY + _airBomberHeight / 2 - 5)), + new Point((int)(_startPosX + _airBomberWidth), (int)(_startPosY + _airBomberHeight / 2 + 5)), + new Point((int)(_startPosX + 20), (int)(_startPosY + _airBomberHeight / 2 + 5)), + }); + + g.FillPolygon(brush, new[] { + new Point((int)(_startPosX), (int)(_startPosY + _airBomberHeight / 2)), + new Point((int)(_startPosX + 20), (int)(_startPosY + _airBomberHeight / 2 - 5)), + new Point((int)(_startPosX + 20), (int)(_startPosY + _airBomberHeight / 2 + 5)), + }); + } public void ChangeBorders(int width, int height) diff --git a/AirBomber/AirBomber/FormAirBomber.Designer.cs b/AirBomber/AirBomber/FormAirBomber.Designer.cs index 38dd70b..e939b45 100644 --- a/AirBomber/AirBomber/FormAirBomber.Designer.cs +++ b/AirBomber/AirBomber/FormAirBomber.Designer.cs @@ -34,10 +34,10 @@ this.toolStripStatusLabelWeight = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripStatusLabelBodyColor = new System.Windows.Forms.ToolStripStatusLabel(); this.buttonCreate = new System.Windows.Forms.Button(); - this.button2 = new System.Windows.Forms.Button(); - this.button3 = new System.Windows.Forms.Button(); - this.button4 = new System.Windows.Forms.Button(); - this.button5 = new System.Windows.Forms.Button(); + this.buttonUp = new System.Windows.Forms.Button(); + this.buttonLeft = new System.Windows.Forms.Button(); + this.buttonDown = new System.Windows.Forms.Button(); + this.buttonRight = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxAirBomber)).BeginInit(); this.statusStrip.SuspendLayout(); this.SuspendLayout(); @@ -47,9 +47,10 @@ this.pictureBoxAirBomber.Dock = System.Windows.Forms.DockStyle.Fill; this.pictureBoxAirBomber.Location = new System.Drawing.Point(0, 0); this.pictureBoxAirBomber.Name = "pictureBoxAirBomber"; - this.pictureBoxAirBomber.Size = new System.Drawing.Size(800, 450); + this.pictureBoxAirBomber.Size = new System.Drawing.Size(874, 515); this.pictureBoxAirBomber.TabIndex = 0; this.pictureBoxAirBomber.TabStop = false; + this.pictureBoxAirBomber.Resize += new System.EventHandler(this.PictureBoxAirBomber_Resize); // // statusStrip // @@ -57,9 +58,9 @@ this.toolStripStatusLabelSpeed, this.toolStripStatusLabelWeight, this.toolStripStatusLabelBodyColor}); - this.statusStrip.Location = new System.Drawing.Point(0, 428); + this.statusStrip.Location = new System.Drawing.Point(0, 493); this.statusStrip.Name = "statusStrip"; - this.statusStrip.Size = new System.Drawing.Size(800, 22); + this.statusStrip.Size = new System.Drawing.Size(874, 22); this.statusStrip.TabIndex = 1; // // toolStripStatusLabelSpeed @@ -82,62 +83,72 @@ // // buttonCreate // - this.buttonCreate.Location = new System.Drawing.Point(12, 390); + this.buttonCreate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.buttonCreate.Location = new System.Drawing.Point(12, 455); this.buttonCreate.Name = "buttonCreate"; this.buttonCreate.Size = new System.Drawing.Size(79, 35); this.buttonCreate.TabIndex = 2; this.buttonCreate.Text = "Создать"; this.buttonCreate.UseVisualStyleBackColor = true; + this.buttonCreate.Click += new System.EventHandler(this.ButtonCreate_Click); // - // button2 + // buttonUp // - this.button2.BackgroundImage = global::AirBomber.Properties.Resources.ArrowUp; - this.button2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.button2.Location = new System.Drawing.Point(722, 367); - this.button2.Name = "button2"; - this.button2.Size = new System.Drawing.Size(30, 30); - this.button2.TabIndex = 3; - this.button2.UseVisualStyleBackColor = true; + this.buttonUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonUp.BackgroundImage = global::AirBomber.Properties.Resources.ArrowUp; + this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; + this.buttonUp.Location = new System.Drawing.Point(796, 432); + this.buttonUp.Name = "buttonUp"; + this.buttonUp.Size = new System.Drawing.Size(30, 30); + this.buttonUp.TabIndex = 3; + this.buttonUp.UseVisualStyleBackColor = true; + this.buttonUp.Click += new System.EventHandler(this.ButtonCreate_Move); // - // button3 + // buttonLeft // - this.button3.BackgroundImage = global::AirBomber.Properties.Resources.ArrowLeft; - this.button3.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.button3.Location = new System.Drawing.Point(686, 403); - this.button3.Name = "button3"; - this.button3.Size = new System.Drawing.Size(30, 30); - this.button3.TabIndex = 4; - this.button3.UseVisualStyleBackColor = true; + this.buttonLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonLeft.BackgroundImage = global::AirBomber.Properties.Resources.ArrowLeft; + this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; + this.buttonLeft.Location = new System.Drawing.Point(760, 468); + this.buttonLeft.Name = "buttonLeft"; + this.buttonLeft.Size = new System.Drawing.Size(30, 30); + this.buttonLeft.TabIndex = 4; + this.buttonLeft.UseVisualStyleBackColor = true; + this.buttonLeft.Click += new System.EventHandler(this.ButtonCreate_Move); // - // button4 + // buttonDown // - this.button4.BackgroundImage = global::AirBomber.Properties.Resources.ArrowDown; - this.button4.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.button4.Location = new System.Drawing.Point(722, 403); - this.button4.Name = "button4"; - this.button4.Size = new System.Drawing.Size(30, 30); - this.button4.TabIndex = 5; - this.button4.UseVisualStyleBackColor = true; + this.buttonDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonDown.BackgroundImage = global::AirBomber.Properties.Resources.ArrowDown; + this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; + this.buttonDown.Location = new System.Drawing.Point(796, 468); + this.buttonDown.Name = "buttonDown"; + this.buttonDown.Size = new System.Drawing.Size(30, 30); + this.buttonDown.TabIndex = 5; + this.buttonDown.UseVisualStyleBackColor = true; + this.buttonDown.Click += new System.EventHandler(this.ButtonCreate_Move); // - // button5 + // buttonRight // - this.button5.BackgroundImage = global::AirBomber.Properties.Resources.ArrowRight; - this.button5.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.button5.Location = new System.Drawing.Point(758, 403); - this.button5.Name = "button5"; - this.button5.Size = new System.Drawing.Size(30, 30); - this.button5.TabIndex = 6; - this.button5.UseVisualStyleBackColor = true; + this.buttonRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonRight.BackgroundImage = global::AirBomber.Properties.Resources.ArrowRight; + this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; + this.buttonRight.Location = new System.Drawing.Point(832, 468); + this.buttonRight.Name = "buttonRight"; + this.buttonRight.Size = new System.Drawing.Size(30, 30); + this.buttonRight.TabIndex = 6; + this.buttonRight.UseVisualStyleBackColor = true; + this.buttonRight.Click += new System.EventHandler(this.ButtonCreate_Move); // // FormAirBomber // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(800, 450); - this.Controls.Add(this.button5); - this.Controls.Add(this.button4); - this.Controls.Add(this.button3); - this.Controls.Add(this.button2); + this.ClientSize = new System.Drawing.Size(874, 515); + this.Controls.Add(this.buttonRight); + this.Controls.Add(this.buttonDown); + this.Controls.Add(this.buttonLeft); + this.Controls.Add(this.buttonUp); this.Controls.Add(this.buttonCreate); this.Controls.Add(this.statusStrip); this.Controls.Add(this.pictureBoxAirBomber); @@ -159,9 +170,9 @@ private ToolStripStatusLabel toolStripStatusLabelWeight; private ToolStripStatusLabel toolStripStatusLabelBodyColor; private Button buttonCreate; - private Button button2; - private Button button3; - private Button button4; - private Button button5; + private Button buttonUp; + private Button buttonLeft; + private Button buttonDown; + private Button buttonRight; } } \ No newline at end of file diff --git a/AirBomber/AirBomber/FormAirBomber.cs b/AirBomber/AirBomber/FormAirBomber.cs index e998b26..f521ff7 100644 --- a/AirBomber/AirBomber/FormAirBomber.cs +++ b/AirBomber/AirBomber/FormAirBomber.cs @@ -2,9 +2,57 @@ namespace AirBomber { public partial class FormAirBomber : Form { + private DrawningBomber _airBomber; public FormAirBomber() { InitializeComponent(); } + + private void Draw() + { + Bitmap bmp = new(pictureBoxAirBomber.Width, pictureBoxAirBomber.Height); + Graphics gr = Graphics.FromImage(bmp); + _airBomber?.DrawTransport(gr); + pictureBoxAirBomber.Image = bmp; + } + + private void ButtonCreate_Click(object sender, EventArgs e) + { + Random rnd = new(); + _airBomber = new DrawningBomber(); + _airBomber.Init(rnd.Next(100, 300), rnd.Next(1000, 2000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256))); + _airBomber.SetPosition(rnd.Next(10, 100), rnd.Next(10, 100), pictureBoxAirBomber.Width, pictureBoxAirBomber.Height); + toolStripStatusLabelSpeed.Text = $": {_airBomber.AirBomber.Speed}"; + toolStripStatusLabelWeight.Text = $": {_airBomber.AirBomber.Weight}"; + toolStripStatusLabelBodyColor.Text = $": {_airBomber.AirBomber.BodyColor}"; + Draw(); + } + + private void ButtonCreate_Move(object sender, EventArgs e) + { + string name = ((Button)sender)?.Name ?? string.Empty; + switch(name) + { + case "buttonUp": + _airBomber?.MoveTransport(Direction.Up); + break; + case "buttonDown": + _airBomber?.MoveTransport(Direction.Down); + break; + case "buttonLeft": + _airBomber?.MoveTransport(Direction.Left); + break; + case "buttonRight": + _airBomber?.MoveTransport(Direction.Right); + break; + } + Draw(); + } + + private void PictureBoxAirBomber_Resize(object sender, EventArgs e) + { + _airBomber?.ChangeBorders(pictureBoxAirBomber.Width, pictureBoxAirBomber.Height); + Draw(); + } } } \ No newline at end of file -- 2.25.1 From 1f16cad283ee6aec669cbf46586e740035bc874f Mon Sep 17 00:00:00 2001 From: the Date: Wed, 21 Sep 2022 10:49:29 +0400 Subject: [PATCH 3/3] =?UTF-8?q?=D0=9F=D0=BE=D0=BB=D0=BD=D0=BE=D1=81=D1=82?= =?UTF-8?q?=D1=8C=D1=8E=20=D1=81=D0=B4=D0=B5=D0=BB=D0=B0=D0=BD=D0=BD=D0=B0?= =?UTF-8?q?=D1=8F=20=D0=BB=D0=B0=D0=B1=D0=BE=D1=80=D0=B0=D1=82=D0=BE=D1=80?= =?UTF-8?q?=D0=BD=D0=B0=D1=8F=20=E2=84=961=20=D0=B1=D0=B0=D0=B7=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0=D1=8F.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AirBomber/AirBomber/DrawningBomber.cs | 4 ++-- AirBomber/AirBomber/FormAirBomber.Designer.cs | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/AirBomber/AirBomber/DrawningBomber.cs b/AirBomber/AirBomber/DrawningBomber.cs index 1643a4f..6b37f11 100644 --- a/AirBomber/AirBomber/DrawningBomber.cs +++ b/AirBomber/AirBomber/DrawningBomber.cs @@ -24,9 +24,9 @@ namespace AirBomber public void SetPosition(int x, int y, int width, int height) { - if (x > _pictureWidth || x < 0) return; + if (x + _airBomberWidth > width || x < 0) return; else _startPosX = x; - if (y > _pictureHeight || y < 0) return; + if (y + _airBomberHeight> height || y < 0) return; else _startPosY = y; _pictureWidth = width; _pictureHeight = height; diff --git a/AirBomber/AirBomber/FormAirBomber.Designer.cs b/AirBomber/AirBomber/FormAirBomber.Designer.cs index e939b45..9234790 100644 --- a/AirBomber/AirBomber/FormAirBomber.Designer.cs +++ b/AirBomber/AirBomber/FormAirBomber.Designer.cs @@ -48,6 +48,7 @@ this.pictureBoxAirBomber.Location = new System.Drawing.Point(0, 0); this.pictureBoxAirBomber.Name = "pictureBoxAirBomber"; this.pictureBoxAirBomber.Size = new System.Drawing.Size(874, 515); + this.pictureBoxAirBomber.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.pictureBoxAirBomber.TabIndex = 0; this.pictureBoxAirBomber.TabStop = false; this.pictureBoxAirBomber.Resize += new System.EventHandler(this.PictureBoxAirBomber_Resize); -- 2.25.1