diff --git a/ProjectAirFighter/ProjectAirFighter/DrawningAirFighter.cs b/ProjectAirFighter/ProjectAirFighter/DrawningAirFighter.cs
index 0ffc0bb..073191e 100644
--- a/ProjectAirFighter/ProjectAirFighter/DrawningAirFighter.cs
+++ b/ProjectAirFighter/ProjectAirFighter/DrawningAirFighter.cs
@@ -36,7 +36,7 @@ public class DrawningAirFighter
///
/// Ширина прорисовки истребителя
///
- private int? _drawningAirFlighterWidth = 130;
+ private int? _drawningAirFlighterWidth = 120;
///
/// Высота прорисовки истребителя
@@ -53,10 +53,11 @@ public class DrawningAirFighter
/// Признак наличия корпуса
/// Признак наличия рокет
/// Признак наличия дополнительных крыльев
- public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool bodyKit, bool rocket, bool additionalWing)
+ //public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool rocket, bool additionalWing)
+ public void Init(EntityAirFighter entityAirFighter)
{
- EntityAirFighter = new EntityAirFighter();
- EntityAirFighter.Init(speed, weight, bodyColor, additionalColor, bodyKit, rocket, additionalWing);
+ EntityAirFighter = entityAirFighter;
+ //EntityAirFighter.Init(speed, weight, bodyColor, additionalColor, rocket, additionalWing);
_pictureHeight = null;
_pictureWidth = null;
_startPosX = null;
@@ -78,8 +79,14 @@ public class DrawningAirFighter
_pictureHeight = height;
if (_startPosX != null && _startPosY != null)
{
- if (_startPosX.Value < 0) _startPosX = 0;
- if (_startPosY.Value < 0) _startPosY = 0;
+ if (_startPosX.Value < 0)
+ {
+ _startPosX = 0;
+ }
+ if (_startPosY.Value < 0)
+ {
+ _startPosY = 0;
+ }
if (_startPosX.Value + _drawningAirFlighterWidth > _pictureWidth)
{
_startPosX = _pictureWidth - _drawningAirFlighterWidth;
@@ -111,13 +118,19 @@ public class DrawningAirFighter
{
_startPosX = x;
_startPosY = y;
- if (_startPosX.Value < 0) _startPosX = 0;
- if (_startPosY.Value < 0) _startPosY = 0;
- if (_startPosX.Value + _drawningAirFlighterWidth > _pictureWidth)
+ if (_startPosX.Value < 0)
+ {
+ _startPosX = 0;
+ }
+ if (_startPosY.Value < 0)
+ {
+ _startPosY = 0;
+ }
+ if (_startPosX + _drawningAirFlighterWidth > _pictureWidth)
{
_startPosX = _pictureWidth - _drawningAirFlighterWidth;
}
- if (_startPosY.Value + _drawningAirFlighterHeight > _pictureHeight)
+ if (_startPosY + _drawningAirFlighterHeight > _pictureHeight)
{
_startPosY = _pictureHeight - _drawningAirFlighterHeight;
}
@@ -203,9 +216,9 @@ public class DrawningAirFighter
}
//корпус
- g.DrawRectangle(pen, _startPosX.Value + 10, _startPosY.Value + 60, 100, 20);
- Point[] body = { new Point(_startPosX.Value + 110, _startPosY.Value + 80),
- new Point(_startPosX.Value + 130, _startPosY.Value + 70), new Point(_startPosX.Value + 110, _startPosY.Value + 60) };
+ g.DrawRectangle(pen, _startPosX.Value, _startPosY.Value + 60, 100, 20);
+ Point[] body = { new Point(_startPosX.Value + 100, _startPosY.Value + 80),
+ new Point(_startPosX.Value + 120, _startPosY.Value + 70), new Point(_startPosX.Value + 100, _startPosY.Value + 60) };
g.DrawPolygon(pen, body);
//нижнее крыло
Point[] wingUpper = { new Point(_startPosX.Value + 80, _startPosY.Value + 80),
@@ -218,12 +231,12 @@ public class DrawningAirFighter
g.DrawPolygon(pen, wingLower);
//задние крылья
//верхнее
- Point[] rearWingUpper = { new Point(_startPosX.Value + 10, _startPosY.Value + 60), new Point(_startPosX.Value + 10, _startPosY.Value + 30),
+ Point[] rearWingUpper = { new Point(_startPosX.Value, _startPosY.Value + 60), new Point(_startPosX.Value, _startPosY.Value + 30),
new Point(_startPosX.Value + 25, _startPosY.Value + 50), new Point(_startPosX.Value + 25, _startPosY.Value + 60)};
g.DrawPolygon(pen, rearWingUpper);
//нижнее
- Point[] rearWingLower = { new Point(_startPosX.Value + 10, _startPosY.Value + 80),
- new Point(_startPosX.Value + 10, _startPosY.Value + 110),new Point(_startPosX.Value + 25, _startPosY.Value + 90),
+ Point[] rearWingLower = { new Point(_startPosX.Value, _startPosY.Value + 80),
+ new Point(_startPosX.Value, _startPosY.Value + 110),new Point(_startPosX.Value + 25, _startPosY.Value + 90),
new Point(_startPosX.Value + 25, _startPosY.Value + 80) };
g.DrawPolygon(pen, rearWingLower);
@@ -233,7 +246,7 @@ public class DrawningAirFighter
//залив корпуса
Brush br = new SolidBrush(EntityAirFighter.BodyColor);
- g.FillRectangle(br, _startPosX.Value + 10, _startPosY.Value + 60, 100, 20);
+ g.FillRectangle(br, _startPosX.Value, _startPosY.Value + 60, 100, 20);
g.FillPolygon(br, wingLower);
g.FillPolygon(br, wingUpper);
diff --git a/ProjectAirFighter/ProjectAirFighter/EntityAirFighter.cs b/ProjectAirFighter/ProjectAirFighter/EntityAirFighter.cs
index 290a6a1..4869273 100644
--- a/ProjectAirFighter/ProjectAirFighter/EntityAirFighter.cs
+++ b/ProjectAirFighter/ProjectAirFighter/EntityAirFighter.cs
@@ -46,10 +46,9 @@ public class EntityAirFighter
/// Вес
/// Основной цвет
/// Дополнительный цвет
- /// Признак наличия корпуса
/// Признак наличия рокет
/// Признак наличия дополнительных крыльев
- public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool bodyKit, bool rocket, bool additionalWing)
+ public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool rocket, bool additionalWing)
{
Speed = speed;
Weight = weight;
diff --git a/ProjectAirFighter/ProjectAirFighter/FormAirFighter.Designer.cs b/ProjectAirFighter/ProjectAirFighter/FormAirFighter.Designer.cs
index a8105ec..4b6b0f1 100644
--- a/ProjectAirFighter/ProjectAirFighter/FormAirFighter.Designer.cs
+++ b/ProjectAirFighter/ProjectAirFighter/FormAirFighter.Designer.cs
@@ -41,16 +41,20 @@
//
pictureBoxAirFighter.Dock = DockStyle.Fill;
pictureBoxAirFighter.Location = new Point(0, 0);
+ pictureBoxAirFighter.Margin = new Padding(3, 4, 3, 4);
pictureBoxAirFighter.Name = "pictureBoxAirFighter";
- pictureBoxAirFighter.Size = new Size(924, 557);
+ pictureBoxAirFighter.Size = new Size(1056, 743);
pictureBoxAirFighter.TabIndex = 0;
pictureBoxAirFighter.TabStop = false;
+
//
// buttonCreate
//
- buttonCreate.Location = new Point(12, 476);
+ buttonCreate.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
+ buttonCreate.Location = new Point(14, 635);
+ buttonCreate.Margin = new Padding(3, 4, 3, 4);
buttonCreate.Name = "buttonCreate";
- buttonCreate.Size = new Size(75, 23);
+ buttonCreate.Size = new Size(86, 31);
buttonCreate.TabIndex = 1;
buttonCreate.Text = "Создать";
buttonCreate.UseVisualStyleBackColor = true;
@@ -61,9 +65,10 @@
buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonLeft.BackgroundImage = Properties.Resources.left;
buttonLeft.BackgroundImageLayout = ImageLayout.Stretch;
- buttonLeft.Location = new Point(785, 510);
+ buttonLeft.Location = new Point(897, 680);
+ buttonLeft.Margin = new Padding(3, 4, 3, 4);
buttonLeft.Name = "buttonLeft";
- buttonLeft.Size = new Size(35, 35);
+ buttonLeft.Size = new Size(40, 47);
buttonLeft.TabIndex = 2;
buttonLeft.UseVisualStyleBackColor = true;
buttonLeft.ClientSizeChanged += FormAirFighter_SizeChanged;
@@ -74,9 +79,10 @@
buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonUp.BackgroundImage = Properties.Resources.up;
buttonUp.BackgroundImageLayout = ImageLayout.Stretch;
- buttonUp.Location = new Point(828, 469);
+ buttonUp.Location = new Point(946, 625);
+ buttonUp.Margin = new Padding(3, 4, 3, 4);
buttonUp.Name = "buttonUp";
- buttonUp.Size = new Size(35, 35);
+ buttonUp.Size = new Size(40, 47);
buttonUp.TabIndex = 3;
buttonUp.UseVisualStyleBackColor = true;
buttonUp.ClientSizeChanged += FormAirFighter_SizeChanged;
@@ -87,9 +93,10 @@
buttonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonDown.BackgroundImage = Properties.Resources.down;
buttonDown.BackgroundImageLayout = ImageLayout.Stretch;
- buttonDown.Location = new Point(828, 510);
+ buttonDown.Location = new Point(946, 680);
+ buttonDown.Margin = new Padding(3, 4, 3, 4);
buttonDown.Name = "buttonDown";
- buttonDown.Size = new Size(35, 35);
+ buttonDown.Size = new Size(40, 47);
buttonDown.TabIndex = 4;
buttonDown.UseVisualStyleBackColor = true;
buttonDown.ClientSizeChanged += FormAirFighter_SizeChanged;
@@ -100,9 +107,10 @@
buttonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonRight.BackgroundImage = Properties.Resources.right;
buttonRight.BackgroundImageLayout = ImageLayout.Stretch;
- buttonRight.Location = new Point(869, 510);
+ buttonRight.Location = new Point(993, 680);
+ buttonRight.Margin = new Padding(3, 4, 3, 4);
buttonRight.Name = "buttonRight";
- buttonRight.Size = new Size(35, 35);
+ buttonRight.Size = new Size(40, 47);
buttonRight.TabIndex = 5;
buttonRight.UseVisualStyleBackColor = true;
buttonRight.ClientSizeChanged += FormAirFighter_SizeChanged;
@@ -110,15 +118,16 @@
//
// FormAirFighter
//
- AutoScaleDimensions = new SizeF(7F, 15F);
+ AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
- ClientSize = new Size(924, 557);
+ ClientSize = new Size(1056, 743);
Controls.Add(buttonRight);
Controls.Add(buttonDown);
Controls.Add(buttonUp);
Controls.Add(buttonLeft);
Controls.Add(buttonCreate);
Controls.Add(pictureBoxAirFighter);
+ Margin = new Padding(3, 4, 3, 4);
Name = "FormAirFighter";
Text = "Истребитель";
SizeChanged += FormAirFighter_SizeChanged;
diff --git a/ProjectAirFighter/ProjectAirFighter/FormAirFighter.cs b/ProjectAirFighter/ProjectAirFighter/FormAirFighter.cs
index 291bc0f..6b7188e 100644
--- a/ProjectAirFighter/ProjectAirFighter/FormAirFighter.cs
+++ b/ProjectAirFighter/ProjectAirFighter/FormAirFighter.cs
@@ -11,6 +11,8 @@ using System.Windows.Forms;
namespace ProjectAirFighter
{
public partial class FormAirFighter : Form
+
+
{
private DrawningAirFighter? _drawningAirFighter;
@@ -35,13 +37,13 @@ namespace ProjectAirFighter
_drawningAirFighter = new DrawningAirFighter();
_entityAirFighter = new EntityAirFighter();
- _drawningAirFighter.Init(random.Next(100, 300), random.Next(1000, 3000),
+ _entityAirFighter.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)));
+ Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)));
+ _drawningAirFighter.Init(_entityAirFighter);
_drawningAirFighter.SetPictureSize(pictureBoxAirFighter.Width, pictureBoxAirFighter.Height);
- _drawningAirFighter.SetPictureSize(pictureBoxAirFighter.Width, pictureBoxAirFighter.Height);
- _drawningAirFighter.SetPosition(random.Next(10, 100), random.Next(10, 100));
+ _drawningAirFighter.SetPosition(random.Next(40, 100), random.Next(40, 100));
Draw();
}