diff --git a/AirplaneWithRadar/AirplaneWithRadar/AirplaneWithRadar.csproj b/AirplaneWithRadar/AirplaneWithRadar/AirplaneWithRadar.csproj index b57c89e..13ee123 100644 --- a/AirplaneWithRadar/AirplaneWithRadar/AirplaneWithRadar.csproj +++ b/AirplaneWithRadar/AirplaneWithRadar/AirplaneWithRadar.csproj @@ -8,4 +8,19 @@ enable + + + True + True + Resources.resx + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + \ No newline at end of file diff --git a/AirplaneWithRadar/AirplaneWithRadar/CountPortholes.cs b/AirplaneWithRadar/AirplaneWithRadar/CountPortholes.cs new file mode 100644 index 0000000..83a8bac --- /dev/null +++ b/AirplaneWithRadar/AirplaneWithRadar/CountPortholes.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AirplaneWithRadar +{ + internal enum CountPortholes + { + Ten = 10, + Twetwenty = 20, + Thirty = 30, + } +} diff --git a/AirplaneWithRadar/AirplaneWithRadar/Direction.cs b/AirplaneWithRadar/AirplaneWithRadar/Direction.cs new file mode 100644 index 0000000..b06f00b --- /dev/null +++ b/AirplaneWithRadar/AirplaneWithRadar/Direction.cs @@ -0,0 +1,14 @@ + +namespace AirplaneWithRadar +{ + /// + /// Направление перемещения + /// + internal enum Direction + { + Up = 1, + Down = 2, + Left = 3, + Right = 4 + } +} diff --git a/AirplaneWithRadar/AirplaneWithRadar/DrawingAirplane.cs b/AirplaneWithRadar/AirplaneWithRadar/DrawingAirplane.cs new file mode 100644 index 0000000..ebfa28c --- /dev/null +++ b/AirplaneWithRadar/AirplaneWithRadar/DrawingAirplane.cs @@ -0,0 +1,188 @@ + +namespace AirplaneWithRadar +{ + /// + /// Класс, отвечающий за прорисовку и перемещение объекта-сущности + /// + internal class DrawningAirplane + { + /// + /// Класс-сущность + /// + public EntityAirplane Airplane { private set; get; } + public DrawningAirplanePortholes DrawningPortholes { get; private set; } + /// + /// Левая координата отрисовки самолёта + /// + private float _startPosX; + /// + /// Верхняя кооридната отрисовки самолёта + /// + private float _startPosY; + /// + /// Ширина окна отрисовки + /// + private int? _pictureWidth = null; + /// + /// Высота окна отрисовки + /// + private int? _pictureHeight = null; + /// + /// Ширина отрисовки + /// + private readonly int _airplaneWidth = 100; + /// + /// Высота отрисовки самолёта + /// + private readonly int _airplaneHeight = 20; + /// + /// Инициализация свойств + /// + /// Скорость + /// Вес + /// Цвет + public void Init(int speed, float weight, Color bodyColor) + { + Airplane = new EntityAirplane(); + Airplane.Init(speed, weight, bodyColor); + DrawningPortholes = new(); + DrawningPortholes.CountPortholes = 10; + } + /// + /// Установка позиции + /// + /// Координата X + /// Координата Y + /// Ширина картинки + /// Высота картинки + public void SetPosition(int x, int y, int width, int height) + { + if (x < 0 || y < 0 || width <= _airplaneWidth || height <= _airplaneHeight || x + _airplaneWidth > width || y + _airplaneHeight > height) + { + _pictureHeight = null; + _pictureWidth = null; + } + + _startPosX = x; + _startPosY = y; + _pictureWidth = width; + _pictureHeight = height; + } + /// + /// Изменение направления перемещения + /// + /// Направление + public void MoveTransport(Direction direction) + { + if (!_pictureWidth.HasValue || !_pictureHeight.HasValue) + { + return; + } + switch (direction) + { + // вправо + case Direction.Right: + if (_startPosX + _airplaneWidth + Airplane.Step < _pictureWidth) + { + _startPosX += Airplane.Step; + } + break; + //влево + case Direction.Left: + if (_startPosX - Airplane.Step > 0) + { + _startPosX -= Airplane.Step; + } + break; + //вверх + case Direction.Up: + if (_startPosY - Airplane.Step > 0) + { + _startPosY -= Airplane.Step; + } + break; + //вниз + case Direction.Down: + if (_startPosY + _airplaneHeight + Airplane.Step < _pictureHeight) + { + _startPosY += Airplane.Step; + } + break; + } + } + /// + /// Отрисовка самолёта + /// + /// + public void DrawTransport(Graphics g) + { + if (_startPosX < 0 || _startPosY < 0 + || !_pictureHeight.HasValue || !_pictureWidth.HasValue) + { + return; + } + Pen pen = new(Color.Black); + Brush brush = new SolidBrush(Airplane.BodyColor); + int h = 10; + _startPosY += 4; + //корпус + g.DrawRectangle(pen, _startPosX, _startPosY + h - 7, _airplaneWidth - 15, h); + + //нос + PointF[] point = new PointF[3]; + point[0] = new PointF(_startPosX + _airplaneWidth - 15, _startPosY + h / 3); + point[1] = new PointF(_startPosX + _airplaneWidth, _startPosY + h - 3); + point[2] = new PointF(_startPosX + _airplaneWidth - 15, _startPosY + h + (h / 3)); + g.FillPolygon(brush, point); + + + //хвост + point = new PointF[3]; + point[0] = new PointF(_startPosX, _startPosY - 10); + point[1] = new PointF(_startPosX, _startPosY + h / 3); + point[2] = new PointF(_startPosX + 15, _startPosY + h / 3); + g.FillPolygon(brush, point); + + //крылья + g.DrawLine(pen, _startPosX + 20, _startPosY + h , _startPosX + 60, _startPosY + h ); + g.DrawLine(pen, _startPosX + 20, _startPosY + h +1 , _startPosX + 60, _startPosY + h +1); + + g.DrawLine(pen, _startPosX - 1, _startPosY + h / 3, _startPosX + 15, _startPosY + h / 3); + g.DrawLine(pen, _startPosX - 1, _startPosY + h / 3 + 1, _startPosX + 15, _startPosY + h / 3 + 1); + g.DrawLine(pen, _startPosX - 1, _startPosY + h / 3 + 2, _startPosX + 15, _startPosY + h / 3 + 2); + + //колёса + g.DrawRectangle(pen, _startPosX + 20, _startPosY + h + (h / 3), 2, 2); + g.DrawRectangle(pen, _startPosX + 24, _startPosY + h + (h / 3), 2, 2); + g.DrawRectangle(pen, _startPosX + _airplaneWidth - 20, _startPosY + h + (h / 3), 2, 2); + DrawningPortholes.DrawPortholes(g, (int)_startPosX+5, (int)_startPosY+5, (int)_airplaneWidth); + _startPosY -= 4; + + } + /// + /// Смена границ формы отрисовки + /// + /// Ширина картинки + /// Высота картинки + public void ChangeBorders(int width, int height) + { + _pictureWidth = width; + _pictureHeight = height; + if (_pictureWidth <= _airplaneWidth || _pictureHeight <= _airplaneHeight) + { + _pictureWidth = null; + _pictureHeight = null; + return; + } + if (_startPosX + _airplaneWidth > _pictureWidth) + { + _startPosX = _pictureWidth.Value - _airplaneWidth; + } + if (_startPosY + _airplaneHeight > _pictureHeight) + { + _startPosY = _pictureHeight.Value - _airplaneHeight; + } + } + } + +} diff --git a/AirplaneWithRadar/AirplaneWithRadar/DrawningAirplanePortholes.cs b/AirplaneWithRadar/AirplaneWithRadar/DrawningAirplanePortholes.cs new file mode 100644 index 0000000..2c94173 --- /dev/null +++ b/AirplaneWithRadar/AirplaneWithRadar/DrawningAirplanePortholes.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AirplaneWithRadar +{ + internal class DrawningAirplanePortholes + { + private CountPortholes _countPortholes; + + public int CountPortholes + { + set + { + _countPortholes = (CountPortholes)(value); + } + } + + public void DrawPortholes(Graphics g, int _startPosX, int _startPosY, int _airplaneWidth) + { + int middle = _startPosX + ((_airplaneWidth - 25) / 2); + DrawPorthole(g, middle, _startPosY); + int left = middle - 5; + int right = middle + 5; + for (var i = 1; i <= (int)_countPortholes / 4; i += 1) + { + DrawPorthole(g, left, _startPosY); + left -= 5; + DrawPorthole(g, right, _startPosY); + right += 5; + } + } + + private void DrawPorthole(Graphics g, int _startPosX, int _startPosY) + { + Pen pen = new(Color.Black); + g.DrawRectangle(pen, _startPosX, _startPosY, 2, 2); + } + } +} \ No newline at end of file diff --git a/AirplaneWithRadar/AirplaneWithRadar/EntityAirplane.cs b/AirplaneWithRadar/AirplaneWithRadar/EntityAirplane.cs new file mode 100644 index 0000000..ef80d96 --- /dev/null +++ b/AirplaneWithRadar/AirplaneWithRadar/EntityAirplane.cs @@ -0,0 +1,40 @@ + +namespace AirplaneWithRadar +{ + /// + /// Класс-сущность "Самолёт" + /// + internal class EntityAirplane + { + /// + /// Скорость + /// + 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/AirplaneWithRadar/AirplaneWithRadar/Form1.Designer.cs b/AirplaneWithRadar/AirplaneWithRadar/Form1.Designer.cs deleted file mode 100644 index 635f08f..0000000 --- a/AirplaneWithRadar/AirplaneWithRadar/Form1.Designer.cs +++ /dev/null @@ -1,39 +0,0 @@ -namespace AirplaneWithRadar -{ - 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/AirplaneWithRadar/AirplaneWithRadar/Form1.cs b/AirplaneWithRadar/AirplaneWithRadar/Form1.cs deleted file mode 100644 index ebb1849..0000000 --- a/AirplaneWithRadar/AirplaneWithRadar/Form1.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace AirplaneWithRadar -{ - public partial class Form1 : Form - { - public Form1() - { - InitializeComponent(); - } - } -} \ No newline at end of file diff --git a/AirplaneWithRadar/AirplaneWithRadar/FormAirplane.Designer.cs b/AirplaneWithRadar/AirplaneWithRadar/FormAirplane.Designer.cs new file mode 100644 index 0000000..d8cf5c7 --- /dev/null +++ b/AirplaneWithRadar/AirplaneWithRadar/FormAirplane.Designer.cs @@ -0,0 +1,208 @@ +namespace AirplaneWithRadar +{ + partial class FormAirplane + { + /// + /// 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.statusStrip1 = 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.pictureBoxAirplane = new System.Windows.Forms.PictureBox(); + this.buttonCreate = 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(); + this.labelPortholes = new System.Windows.Forms.Label(); + this.comboBoxPortholes = new System.Windows.Forms.ComboBox(); + this.statusStrip1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBoxAirplane)).BeginInit(); + this.SuspendLayout(); + // + // statusStrip1 + // + this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripStatusLabelSpeed, + this.toolStripStatusLabelWeight, + this.toolStripStatusLabelBodyColor}); + this.statusStrip1.Location = new System.Drawing.Point(0, 428); + this.statusStrip1.Name = "statusStrip1"; + this.statusStrip1.Size = new System.Drawing.Size(800, 22); + this.statusStrip1.TabIndex = 0; + this.statusStrip1.Text = "statusStrip1"; + // + // 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 = "Цвет:"; + // + // pictureBoxAirplane + // + this.pictureBoxAirplane.Dock = System.Windows.Forms.DockStyle.Fill; + this.pictureBoxAirplane.Location = new System.Drawing.Point(0, 0); + this.pictureBoxAirplane.Name = "pictureBoxAirplane"; + this.pictureBoxAirplane.Size = new System.Drawing.Size(800, 428); + this.pictureBoxAirplane.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; + this.pictureBoxAirplane.TabIndex = 1; + this.pictureBoxAirplane.TabStop = false; + this.pictureBoxAirplane.Resize += new System.EventHandler(this.PictureBoxAirplane_Resize); + // + // 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, 395); + 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); + // + // buttonUp + // + this.buttonUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonUp.BackgroundImage = global::AirplaneWithRadar.Properties.Resources.arrUp; + this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; + this.buttonUp.Location = new System.Drawing.Point(722, 359); + 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.ButtonMove_Click); + // + // buttonLeft + // + this.buttonLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonLeft.BackgroundImage = global::AirplaneWithRadar.Properties.Resources.arrLeft; + this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; + this.buttonLeft.Location = new System.Drawing.Point(686, 395); + 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.ButtonMove_Click); + // + // buttonDown + // + this.buttonDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonDown.BackgroundImage = global::AirplaneWithRadar.Properties.Resources.arrDown; + this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; + this.buttonDown.Location = new System.Drawing.Point(722, 395); + 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.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonRight.BackgroundImage = global::AirplaneWithRadar.Properties.Resources.arrRight; + this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; + this.buttonRight.Location = new System.Drawing.Point(758, 395); + 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); + // + // labelPortholes + // + this.labelPortholes.AutoSize = true; + this.labelPortholes.Location = new System.Drawing.Point(12, 374); + this.labelPortholes.Name = "labelPortholes"; + this.labelPortholes.Size = new System.Drawing.Size(177, 15); + this.labelPortholes.TabIndex = 7; + this.labelPortholes.Text = "Колличество иллюминаторов:"; + // + // comboBoxPortholes + // + this.comboBoxPortholes.FormattingEnabled = true; + this.comboBoxPortholes.Items.AddRange(new object[] { + "10", + "20", + "30"}); + this.comboBoxPortholes.Location = new System.Drawing.Point(195, 371); + this.comboBoxPortholes.Name = "comboBoxPortholes"; + this.comboBoxPortholes.Size = new System.Drawing.Size(44, 23); + this.comboBoxPortholes.TabIndex = 8; + this.comboBoxPortholes.Text = "10"; + // + // FormAirplane + // + 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.comboBoxPortholes); + this.Controls.Add(this.labelPortholes); + 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.pictureBoxAirplane); + this.Controls.Add(this.statusStrip1); + this.Name = "FormAirplane"; + this.Text = "Самолёт"; + this.statusStrip1.ResumeLayout(false); + this.statusStrip1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBoxAirplane)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private StatusStrip statusStrip1; + private ToolStripStatusLabel toolStripStatusLabelSpeed; + private ToolStripStatusLabel toolStripStatusLabelWeight; + private ToolStripStatusLabel toolStripStatusLabelBodyColor; + private PictureBox pictureBoxAirplane; + private Button buttonCreate; + private Button buttonUp; + private Button buttonLeft; + private Button buttonDown; + private Button buttonRight; + private Label labelPortholes; + private ComboBox comboBoxPortholes; + } +} \ No newline at end of file diff --git a/AirplaneWithRadar/AirplaneWithRadar/FormAirplane.cs b/AirplaneWithRadar/AirplaneWithRadar/FormAirplane.cs new file mode 100644 index 0000000..f980d42 --- /dev/null +++ b/AirplaneWithRadar/AirplaneWithRadar/FormAirplane.cs @@ -0,0 +1,80 @@ +namespace AirplaneWithRadar +{ + public partial class FormAirplane : Form + { + private DrawningAirplane _airplane; + + public FormAirplane() + { + InitializeComponent(); + } + + /// + /// + /// + + private void Draw() + { + Bitmap bmp = new(pictureBoxAirplane.Width, pictureBoxAirplane.Height); + Graphics gr = Graphics.FromImage(bmp); + _airplane?.DrawTransport(gr); + pictureBoxAirplane.Image = bmp; + } + /// + /// "" + /// + /// + /// + /// + + private void buttonCreate_Click(object sender, EventArgs e) + { + Random rnd = new(); + _airplane = new DrawningAirplane(); + _airplane.Init(rnd.Next(100, 300), rnd.Next(1000, 2000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256))); + _airplane.DrawningPortholes.CountPortholes = Convert.ToInt32(comboBoxPortholes.Text); + _airplane.SetPosition(rnd.Next(20, 100), rnd.Next(20, 100), pictureBoxAirplane.Width, pictureBoxAirplane.Height); + toolStripStatusLabelSpeed.Text = $": {_airplane.Airplane.Speed}"; + toolStripStatusLabelWeight.Text = $": {_airplane.Airplane.Weight}"; + toolStripStatusLabelBodyColor.Text = $": {_airplane.Airplane.BodyColor.Name}"; + Draw(); + } + + /// + /// + /// + /// + /// + private void ButtonMove_Click(object sender, EventArgs e) + { + // + string name = ((Button)sender)?.Name ?? string.Empty; + switch (name) + { + case "buttonUp": + _airplane?.MoveTransport(Direction.Up); + break; + case "buttonDown": + _airplane?.MoveTransport(Direction.Down); + break; + case "buttonLeft": + _airplane?.MoveTransport(Direction.Left); + break; + case "buttonRight": + _airplane?.MoveTransport(Direction.Right); + break; + } + Draw(); + } + /// + /// + /// + /// + /// + private void PictureBoxAirplane_Resize(object sender, EventArgs e) + { + _airplane?.ChangeBorders(pictureBoxAirplane.Width, pictureBoxAirplane.Height); + Draw(); + } + } +} \ No newline at end of file diff --git a/AirplaneWithRadar/AirplaneWithRadar/FormAirplane.resx b/AirplaneWithRadar/AirplaneWithRadar/FormAirplane.resx new file mode 100644 index 0000000..5cb320f --- /dev/null +++ b/AirplaneWithRadar/AirplaneWithRadar/FormAirplane.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/AirplaneWithRadar/AirplaneWithRadar/Program.cs b/AirplaneWithRadar/AirplaneWithRadar/Program.cs index cf770a7..319f64d 100644 --- a/AirplaneWithRadar/AirplaneWithRadar/Program.cs +++ b/AirplaneWithRadar/AirplaneWithRadar/Program.cs @@ -11,7 +11,7 @@ namespace AirplaneWithRadar // 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 FormAirplane()); } } } \ No newline at end of file diff --git a/AirplaneWithRadar/AirplaneWithRadar/Properties/Resources.Designer.cs b/AirplaneWithRadar/AirplaneWithRadar/Properties/Resources.Designer.cs new file mode 100644 index 0000000..feb79ab --- /dev/null +++ b/AirplaneWithRadar/AirplaneWithRadar/Properties/Resources.Designer.cs @@ -0,0 +1,103 @@ +//------------------------------------------------------------------------------ +// +// Этот код создан программой. +// Исполняемая версия:4.0.30319.42000 +// +// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае +// повторной генерации кода. +// +//------------------------------------------------------------------------------ + +namespace AirplaneWithRadar.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("AirplaneWithRadar.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 arrDown { + get { + object obj = ResourceManager.GetObject("arrDown", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap arrLeft { + get { + object obj = ResourceManager.GetObject("arrLeft", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap arrRight { + get { + object obj = ResourceManager.GetObject("arrRight", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap arrUp { + get { + object obj = ResourceManager.GetObject("arrUp", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + } +} diff --git a/AirplaneWithRadar/AirplaneWithRadar/Form1.resx b/AirplaneWithRadar/AirplaneWithRadar/Properties/Resources.resx similarity index 83% rename from AirplaneWithRadar/AirplaneWithRadar/Form1.resx rename to AirplaneWithRadar/AirplaneWithRadar/Properties/Resources.resx index 1af7de1..9b7bb8e 100644 --- a/AirplaneWithRadar/AirplaneWithRadar/Form1.resx +++ b/AirplaneWithRadar/AirplaneWithRadar/Properties/Resources.resx @@ -117,4 +117,17 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\arrDown.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\arrLeft.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\arrRight.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\arrUp.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/AirplaneWithRadar/AirplaneWithRadar/Resources/arrDown.png b/AirplaneWithRadar/AirplaneWithRadar/Resources/arrDown.png new file mode 100644 index 0000000..238e499 Binary files /dev/null and b/AirplaneWithRadar/AirplaneWithRadar/Resources/arrDown.png differ diff --git a/AirplaneWithRadar/AirplaneWithRadar/Resources/arrLeft.png b/AirplaneWithRadar/AirplaneWithRadar/Resources/arrLeft.png new file mode 100644 index 0000000..d0b3d41 Binary files /dev/null and b/AirplaneWithRadar/AirplaneWithRadar/Resources/arrLeft.png differ diff --git a/AirplaneWithRadar/AirplaneWithRadar/Resources/arrRight.png b/AirplaneWithRadar/AirplaneWithRadar/Resources/arrRight.png new file mode 100644 index 0000000..e88164e Binary files /dev/null and b/AirplaneWithRadar/AirplaneWithRadar/Resources/arrRight.png differ diff --git a/AirplaneWithRadar/AirplaneWithRadar/Resources/arrUp.png b/AirplaneWithRadar/AirplaneWithRadar/Resources/arrUp.png new file mode 100644 index 0000000..64b69ad Binary files /dev/null and b/AirplaneWithRadar/AirplaneWithRadar/Resources/arrUp.png differ