diff --git a/SelfPropelledArtilleryUnit/FormArtillery.Designer.cs b/SelfPropelledArtilleryUnit/FormArtillery.Designer.cs
index e201ef2..4248cdf 100644
--- a/SelfPropelledArtilleryUnit/FormArtillery.Designer.cs
+++ b/SelfPropelledArtilleryUnit/FormArtillery.Designer.cs
@@ -1,4 +1,4 @@
-namespace SelfPropelledArtilleryUnit
+namespace Artilleries
{
partial class FormArtillery
{
@@ -28,19 +28,155 @@
///
private void InitializeComponent()
{
+ this.statusStrip1 = new System.Windows.Forms.StatusStrip();
+ this.SpeedStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
+ this.WeightStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
+ this.ColorStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
+ this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
+ this.pictureBoxArtilleries = new System.Windows.Forms.PictureBox();
+ this.buttonCreate = new System.Windows.Forms.Button();
+ this.buttonLeft = new System.Windows.Forms.Button();
+ this.buttonUp = new System.Windows.Forms.Button();
+ this.buttonDown = new System.Windows.Forms.Button();
+ this.buttonRight = new System.Windows.Forms.Button();
+ this.statusStrip1.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBoxArtilleries)).BeginInit();
this.SuspendLayout();
//
+ // statusStrip1
+ //
+ this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.SpeedStatusLabel,
+ this.WeightStatusLabel,
+ this.ColorStatusLabel});
+ this.statusStrip1.Location = new System.Drawing.Point(0, 419);
+ this.statusStrip1.Name = "statusStrip1";
+ this.statusStrip1.Size = new System.Drawing.Size(624, 22);
+ this.statusStrip1.TabIndex = 0;
+ //
+ // SpeedStatusLabel
+ //
+ this.SpeedStatusLabel.Name = "SpeedStatusLabel";
+ this.SpeedStatusLabel.Size = new System.Drawing.Size(62, 17);
+ this.SpeedStatusLabel.Text = "Скорость:";
+ //
+ // WeightStatusLabel
+ //
+ this.WeightStatusLabel.Name = "WeightStatusLabel";
+ this.WeightStatusLabel.Size = new System.Drawing.Size(29, 17);
+ this.WeightStatusLabel.Text = "Вес:";
+ //
+ // ColorStatusLabel
+ //
+ this.ColorStatusLabel.Name = "ColorStatusLabel";
+ this.ColorStatusLabel.Size = new System.Drawing.Size(36, 17);
+ this.ColorStatusLabel.Text = "Цвет:";
+ //
+ // toolStripStatusLabel1
+ //
+ this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
+ this.toolStripStatusLabel1.Size = new System.Drawing.Size(23, 23);
+ //
+ // pictureBoxArtilleries
+ //
+ this.pictureBoxArtilleries.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.pictureBoxArtilleries.Location = new System.Drawing.Point(0, 0);
+ this.pictureBoxArtilleries.Name = "pictureBoxArtilleries";
+ this.pictureBoxArtilleries.Size = new System.Drawing.Size(624, 419);
+ this.pictureBoxArtilleries.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
+ this.pictureBoxArtilleries.TabIndex = 1;
+ this.pictureBoxArtilleries.TabStop = false;
+ //
+ // buttonCreate
+ //
+ 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, 382);
+ this.buttonCreate.Name = "buttonCreate";
+ this.buttonCreate.Size = new System.Drawing.Size(75, 23);
+ this.buttonCreate.TabIndex = 2;
+ this.buttonCreate.Text = "Создать";
+ this.buttonCreate.UseVisualStyleBackColor = true;
+ this.buttonCreate.Click += new System.EventHandler(this.buttonCreate_Click);
+ //
+ // buttonLeft
+ //
+ this.buttonLeft.BackgroundImage = global::SelfPropelledArtilleryUnit.Properties.Resources.ArrowLeft;
+ this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
+ this.buttonLeft.Location = new System.Drawing.Point(509, 375);
+ this.buttonLeft.Name = "buttonLeft";
+ this.buttonLeft.Size = new System.Drawing.Size(30, 30);
+ this.buttonLeft.TabIndex = 3;
+ this.buttonLeft.UseVisualStyleBackColor = true;
+ this.buttonLeft.Click += new System.EventHandler(this.buttonMove_Click);
+ //
+ // buttonUp
+ //
+ this.buttonUp.BackgroundImage = global::SelfPropelledArtilleryUnit.Properties.Resources.ArrowUp;
+ this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
+ this.buttonUp.Location = new System.Drawing.Point(543, 342);
+ this.buttonUp.Name = "buttonUp";
+ this.buttonUp.Size = new System.Drawing.Size(30, 30);
+ this.buttonUp.TabIndex = 4;
+ this.buttonUp.UseVisualStyleBackColor = true;
+ this.buttonUp.Click += new System.EventHandler(this.buttonMove_Click);
+ //
+ // buttonDown
+ //
+ this.buttonDown.BackgroundImage = global::SelfPropelledArtilleryUnit.Properties.Resources.ArrowDown;
+ this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
+ this.buttonDown.Location = new System.Drawing.Point(543, 375);
+ 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.buttonMove_Click);
+ //
+ // buttonRight
+ //
+ this.buttonRight.BackgroundImage = global::SelfPropelledArtilleryUnit.Properties.Resources.ArrowRight;
+ this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
+ this.buttonRight.Location = new System.Drawing.Point(579, 375);
+ 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.buttonMove_Click);
+ //
// FormArtillery
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(800, 450);
+ this.ClientSize = new System.Drawing.Size(624, 441);
+ this.Controls.Add(this.buttonRight);
+ this.Controls.Add(this.buttonDown);
+ this.Controls.Add(this.buttonUp);
+ this.Controls.Add(this.buttonLeft);
+ this.Controls.Add(this.buttonCreate);
+ this.Controls.Add(this.pictureBoxArtilleries);
+ this.Controls.Add(this.statusStrip1);
this.Name = "FormArtillery";
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Artillery";
+ this.statusStrip1.ResumeLayout(false);
+ this.statusStrip1.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBoxArtilleries)).EndInit();
this.ResumeLayout(false);
+ this.PerformLayout();
}
#endregion
+
+ private StatusStrip statusStrip1;
+ private ToolStripStatusLabel toolStripStatusLabel1;
+ private ToolStripStatusLabel SpeedStatusLabel;
+ private ToolStripStatusLabel WeightStatusLabel;
+ private ToolStripStatusLabel ColorStatusLabel;
+ private PictureBox pictureBoxArtilleries;
+ private Button buttonCreate;
+ private Button buttonLeft;
+ private Button buttonUp;
+ private Button buttonDown;
+ private Button buttonRight;
}
}
\ No newline at end of file
diff --git a/SelfPropelledArtilleryUnit/FormArtillery.cs b/SelfPropelledArtilleryUnit/FormArtillery.cs
index 6a3183f..b053a9a 100644
--- a/SelfPropelledArtilleryUnit/FormArtillery.cs
+++ b/SelfPropelledArtilleryUnit/FormArtillery.cs
@@ -1,10 +1,58 @@
-namespace SelfPropelledArtilleryUnit
+namespace Artilleries
{
public partial class FormArtillery : Form
{
+ private DrawingArtillery _artillery;
+
public FormArtillery()
{
InitializeComponent();
}
+ private void Draw()
+ {
+ Bitmap bmp = new(pictureBoxArtilleries.Width, pictureBoxArtilleries.Height);
+ Graphics gr = Graphics.FromImage(bmp);
+ _artillery?.DrawTransport(gr);
+ pictureBoxArtilleries.Image = bmp;
+ }
+
+ private void buttonCreate_Click(object sender, EventArgs e)
+ {
+ Random rnd = new();
+ _artillery = new DrawingArtillery();
+ _artillery.Init(rnd.Next(100, 300), rnd.Next(1000, 2000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)));
+ _artillery.SetPosition(rnd.Next(10, 100), rnd.Next(10, 100), pictureBoxArtilleries.Width, pictureBoxArtilleries.Height);
+ SpeedStatusLabel.Text = $": {_artillery.Artillery.Speed}";
+ WeightStatusLabel.Text = $": {_artillery.Artillery.Weight}";
+ ColorStatusLabel.Text = $": {_artillery.Artillery.BodyColor.Name}";
+ Draw();
+ }
+
+ private void buttonMove_Click(object sender, EventArgs e)
+ {
+ string name = ((Button)sender)?.Name ?? string.Empty;
+ switch (name)
+ {
+ case "buttonUp":
+ _artillery?.MoveTransport(Direction.Up);
+ break;
+ case "buttonDown":
+ _artillery?.MoveTransport(Direction.Down);
+ break;
+ case "buttonLeft":
+ _artillery?.MoveTransport(Direction.Left);
+ break;
+ case "buttonRight":
+ _artillery?.MoveTransport(Direction.Right);
+ break;
+ }
+ Draw();
+ }
+
+ private void pictureBoxArtilleries_Resize(object sender, EventArgs e)
+ {
+ _artillery?.ChangeBorders(pictureBoxArtilleries.Width, pictureBoxArtilleries.Height);
+ Draw();
+ }
}
}
\ No newline at end of file
diff --git a/SelfPropelledArtilleryUnit/FormArtillery.resx b/SelfPropelledArtilleryUnit/FormArtillery.resx
index f298a7b..5cb320f 100644
--- a/SelfPropelledArtilleryUnit/FormArtillery.resx
+++ b/SelfPropelledArtilleryUnit/FormArtillery.resx
@@ -57,4 +57,7 @@
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/SelfPropelledArtilleryUnit/Program.cs b/SelfPropelledArtilleryUnit/Program.cs
index a4ffd66..e993022 100644
--- a/SelfPropelledArtilleryUnit/Program.cs
+++ b/SelfPropelledArtilleryUnit/Program.cs
@@ -1,15 +1,10 @@
-namespace SelfPropelledArtilleryUnit
+namespace Artilleries
{
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 FormArtillery());
}
diff --git a/SelfPropelledArtilleryUnit/Properties/Resources.Designer.cs b/SelfPropelledArtilleryUnit/Properties/Resources.Designer.cs
new file mode 100644
index 0000000..5225a0c
--- /dev/null
+++ b/SelfPropelledArtilleryUnit/Properties/Resources.Designer.cs
@@ -0,0 +1,103 @@
+//------------------------------------------------------------------------------
+//
+// Этот код создан программой.
+// Исполняемая версия:4.0.30319.42000
+//
+// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
+// повторной генерации кода.
+//
+//------------------------------------------------------------------------------
+
+namespace SelfPropelledArtilleryUnit.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("SelfPropelledArtilleryUnit.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/SelfPropelledArtilleryUnit/Properties/Resources.resx b/SelfPropelledArtilleryUnit/Properties/Resources.resx
new file mode 100644
index 0000000..7b1a077
--- /dev/null
+++ b/SelfPropelledArtilleryUnit/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\ArrowDown.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
+
+
+ ..\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
+
+
\ No newline at end of file
diff --git a/SelfPropelledArtilleryUnit/Resources/ArrowDown.png b/SelfPropelledArtilleryUnit/Resources/ArrowDown.png
new file mode 100644
index 0000000..5edca36
Binary files /dev/null and b/SelfPropelledArtilleryUnit/Resources/ArrowDown.png differ
diff --git a/SelfPropelledArtilleryUnit/Resources/ArrowLeft.png b/SelfPropelledArtilleryUnit/Resources/ArrowLeft.png
new file mode 100644
index 0000000..7aff8f8
Binary files /dev/null and b/SelfPropelledArtilleryUnit/Resources/ArrowLeft.png differ
diff --git a/SelfPropelledArtilleryUnit/Resources/ArrowRight.png b/SelfPropelledArtilleryUnit/Resources/ArrowRight.png
new file mode 100644
index 0000000..5561cac
Binary files /dev/null and b/SelfPropelledArtilleryUnit/Resources/ArrowRight.png differ
diff --git a/SelfPropelledArtilleryUnit/Resources/ArrowUp.png b/SelfPropelledArtilleryUnit/Resources/ArrowUp.png
new file mode 100644
index 0000000..d8bd667
Binary files /dev/null and b/SelfPropelledArtilleryUnit/Resources/ArrowUp.png differ