Compare commits
3 Commits
8188c6e0cb
...
0f18368d7f
Author | SHA1 | Date | |
---|---|---|---|
0f18368d7f | |||
69a0414756 | |||
e08aabd3df |
@ -41,7 +41,7 @@
|
||||
}
|
||||
|
||||
_drawningAirPlane = new DrawningAirBomber(random.Next(100, 300), random.Next(1000, 3000), color, dopColor,
|
||||
Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)), pictureBoxAirBomber.Width, pictureBoxAirBomber.Height);
|
||||
Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)), pictureBoxAirBomber.Width, pictureBoxAirBomber.Height, random.Next(1, 4) * 2, random.Next(0, 4));
|
||||
|
||||
_drawningAirPlane.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
||||
Draw();
|
||||
@ -55,7 +55,7 @@
|
||||
{
|
||||
color = dialog.Color;
|
||||
}
|
||||
_drawningAirPlane = new DrawningAirPlane(random.Next(100, 300), random.Next(1000, 3000), color, pictureBoxAirBomber.Width, pictureBoxAirBomber.Height);
|
||||
_drawningAirPlane = new DrawningAirPlane(random.Next(100, 300), random.Next(1000, 3000), color, pictureBoxAirBomber.Width, pictureBoxAirBomber.Height, random.Next(1, 4) * 2, random.Next(0, 4));
|
||||
|
||||
_drawningAirPlane.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
||||
Draw();
|
||||
|
67
AirBomber/AirBomber/FormPlaneCollection.Designer.cs
generated
67
AirBomber/AirBomber/FormPlaneCollection.Designer.cs
generated
@ -29,11 +29,11 @@
|
||||
private void InitializeComponent()
|
||||
{
|
||||
groupBoxTools = new GroupBox();
|
||||
pictureBoxCollection = new PictureBox();
|
||||
buttonAddPlane = new Button();
|
||||
maskedTextBoxNumber = new MaskedTextBox();
|
||||
buttonRemovePlane = new Button();
|
||||
buttonRefreshCollection = new Button();
|
||||
buttonRemovePlane = new Button();
|
||||
maskedTextBoxNumber = new MaskedTextBox();
|
||||
buttonAddPlane = new Button();
|
||||
pictureBoxCollection = new PictureBox();
|
||||
groupBoxTools.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxCollection).BeginInit();
|
||||
SuspendLayout();
|
||||
@ -51,23 +51,25 @@
|
||||
groupBoxTools.TabStop = false;
|
||||
groupBoxTools.Text = "Инструменты";
|
||||
//
|
||||
// pictureBoxCollection
|
||||
// buttonRefreshCollection
|
||||
//
|
||||
pictureBoxCollection.Dock = DockStyle.Left;
|
||||
pictureBoxCollection.Location = new Point(0, 0);
|
||||
pictureBoxCollection.Name = "pictureBoxCollection";
|
||||
pictureBoxCollection.Size = new Size(752, 668);
|
||||
pictureBoxCollection.TabIndex = 1;
|
||||
pictureBoxCollection.TabStop = false;
|
||||
buttonRefreshCollection.Location = new Point(17, 357);
|
||||
buttonRefreshCollection.Name = "buttonRefreshCollection";
|
||||
buttonRefreshCollection.Size = new Size(290, 59);
|
||||
buttonRefreshCollection.TabIndex = 3;
|
||||
buttonRefreshCollection.Text = "Обновить коллекцию";
|
||||
buttonRefreshCollection.UseVisualStyleBackColor = true;
|
||||
buttonRefreshCollection.Click += buttonRefreshCollection_Click;
|
||||
//
|
||||
// buttonAddPlane
|
||||
// buttonRemovePlane
|
||||
//
|
||||
buttonAddPlane.Location = new Point(17, 53);
|
||||
buttonAddPlane.Name = "buttonAddPlane";
|
||||
buttonAddPlane.Size = new Size(290, 59);
|
||||
buttonAddPlane.TabIndex = 0;
|
||||
buttonAddPlane.Text = "Добавить самолет";
|
||||
buttonAddPlane.UseVisualStyleBackColor = true;
|
||||
buttonRemovePlane.Location = new Point(17, 213);
|
||||
buttonRemovePlane.Name = "buttonRemovePlane";
|
||||
buttonRemovePlane.Size = new Size(290, 59);
|
||||
buttonRemovePlane.TabIndex = 2;
|
||||
buttonRemovePlane.Text = "Удалить самолет";
|
||||
buttonRemovePlane.UseVisualStyleBackColor = true;
|
||||
buttonRemovePlane.Click += buttonRemovePlane_Click;
|
||||
//
|
||||
// maskedTextBoxNumber
|
||||
//
|
||||
@ -78,23 +80,24 @@
|
||||
maskedTextBoxNumber.TabIndex = 1;
|
||||
maskedTextBoxNumber.ValidatingType = typeof(int);
|
||||
//
|
||||
// buttonRemovePlane
|
||||
// buttonAddPlane
|
||||
//
|
||||
buttonRemovePlane.Location = new Point(17, 213);
|
||||
buttonRemovePlane.Name = "buttonRemovePlane";
|
||||
buttonRemovePlane.Size = new Size(290, 59);
|
||||
buttonRemovePlane.TabIndex = 2;
|
||||
buttonRemovePlane.Text = "Удалить самолет";
|
||||
buttonRemovePlane.UseVisualStyleBackColor = true;
|
||||
buttonAddPlane.Location = new Point(17, 53);
|
||||
buttonAddPlane.Name = "buttonAddPlane";
|
||||
buttonAddPlane.Size = new Size(290, 59);
|
||||
buttonAddPlane.TabIndex = 0;
|
||||
buttonAddPlane.Text = "Добавить самолет";
|
||||
buttonAddPlane.UseVisualStyleBackColor = true;
|
||||
buttonAddPlane.Click += buttonAddPlane_Click;
|
||||
//
|
||||
// buttonRefreshCollection
|
||||
// pictureBoxCollection
|
||||
//
|
||||
buttonRefreshCollection.Location = new Point(17, 357);
|
||||
buttonRefreshCollection.Name = "buttonRefreshCollection";
|
||||
buttonRefreshCollection.Size = new Size(290, 59);
|
||||
buttonRefreshCollection.TabIndex = 3;
|
||||
buttonRefreshCollection.Text = "Обновить коллекцию";
|
||||
buttonRefreshCollection.UseVisualStyleBackColor = true;
|
||||
pictureBoxCollection.Dock = DockStyle.Left;
|
||||
pictureBoxCollection.Location = new Point(0, 0);
|
||||
pictureBoxCollection.Name = "pictureBoxCollection";
|
||||
pictureBoxCollection.Size = new Size(752, 668);
|
||||
pictureBoxCollection.TabIndex = 1;
|
||||
pictureBoxCollection.TabStop = false;
|
||||
//
|
||||
// FormPlaneCollection
|
||||
//
|
||||
|
@ -12,9 +12,48 @@ namespace AirBomber
|
||||
{
|
||||
public partial class FormPlaneCollection : Form
|
||||
{
|
||||
private readonly PlanesGenericCollection<DrawningAirPlane, DrawningObjectAirPlane> _planes;
|
||||
public FormPlaneCollection()
|
||||
{
|
||||
InitializeComponent();
|
||||
_planes = new PlanesGenericCollection<DrawningAirPlane, DrawningObjectAirPlane>(pictureBoxCollection.Width, pictureBoxCollection.Height);
|
||||
}
|
||||
private void buttonAddPlane_Click(object sender, EventArgs e)
|
||||
{
|
||||
FormAirBomber form = new();
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
if (_planes + form.SelectedPlane != -1)
|
||||
{
|
||||
MessageBox.Show("Объект добавлен");
|
||||
pictureBoxCollection.Image = _planes.ShowPlanes();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Не удалось добавить объект");
|
||||
}
|
||||
}
|
||||
}
|
||||
private void buttonRemovePlane_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (MessageBox.Show("Удалить объект?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
||||
{
|
||||
return;
|
||||
}
|
||||
int pos = Convert.ToInt32(maskedTextBoxNumber.Text);
|
||||
if (_planes - pos != null)
|
||||
{
|
||||
MessageBox.Show("Объект удален");
|
||||
pictureBoxCollection.Image = _planes.ShowPlanes();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Не удалось удалить объект");
|
||||
}
|
||||
}
|
||||
private void buttonRefreshCollection_Click(object sender, EventArgs e)
|
||||
{
|
||||
pictureBoxCollection.Image = _planes.ShowPlanes();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
||||
// To customize application configuration such as set high DPI settings or default font,
|
||||
// see https://aka.ms/applicationconfiguration.
|
||||
ApplicationConfiguration.Initialize();
|
||||
Application.Run(new FormAirBomber());
|
||||
Application.Run(new FormPlaneCollection());
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user