изменения.1

This commit is contained in:
nezui1 2024-04-06 14:06:20 +03:00
parent dd60ab3219
commit d3ebbc092d
3 changed files with 68 additions and 47 deletions

View File

@ -50,7 +50,7 @@ public abstract class AbstractCompany
_pictureWidth = picWidth;
_pictureHeight = picHeight;
_collection = collection;
_collection.SetMaxCount = GetMaxCount - 3;
_collection.SetMaxCount = GetMaxCount - 4;
}
/// <summary>

View File

@ -60,9 +60,11 @@
groupBox1.Controls.Add(panelStorage);
groupBox1.Controls.Add(comboBoxSelectorCompany);
groupBox1.Dock = DockStyle.Right;
groupBox1.Location = new Point(659, 0);
groupBox1.Location = new Point(753, 0);
groupBox1.Margin = new Padding(3, 4, 3, 4);
groupBox1.Name = "groupBox1";
groupBox1.Size = new Size(174, 663);
groupBox1.Padding = new Padding(3, 4, 3, 4);
groupBox1.Size = new Size(199, 884);
groupBox1.TabIndex = 0;
groupBox1.TabStop = false;
groupBox1.Text = "Инструменты";
@ -76,16 +78,18 @@
panelCompanyTools.Controls.Add(maskedTextBoxPosition);
panelCompanyTools.Controls.Add(buttonGoToCheck);
panelCompanyTools.Enabled = false;
panelCompanyTools.Location = new Point(0, 373);
panelCompanyTools.Location = new Point(0, 497);
panelCompanyTools.Margin = new Padding(3, 4, 3, 4);
panelCompanyTools.Name = "panelCompanyTools";
panelCompanyTools.Size = new Size(174, 278);
panelCompanyTools.Size = new Size(199, 371);
panelCompanyTools.TabIndex = 9;
//
// buttonRemove
//
buttonRemove.Location = new Point(6, 145);
buttonRemove.Location = new Point(7, 193);
buttonRemove.Margin = new Padding(3, 4, 3, 4);
buttonRemove.Name = "buttonRemove";
buttonRemove.Size = new Size(162, 44);
buttonRemove.Size = new Size(185, 59);
buttonRemove.TabIndex = 4;
buttonRemove.Text = "Удалить самолет";
buttonRemove.UseVisualStyleBackColor = true;
@ -93,9 +97,10 @@
//
// buttonAddWarPlane
//
buttonAddWarPlane.Location = new Point(6, 3);
buttonAddWarPlane.Location = new Point(7, 4);
buttonAddWarPlane.Margin = new Padding(3, 4, 3, 4);
buttonAddWarPlane.Name = "buttonAddWarPlane";
buttonAddWarPlane.Size = new Size(162, 52);
buttonAddWarPlane.Size = new Size(185, 69);
buttonAddWarPlane.TabIndex = 1;
buttonAddWarPlane.Text = "Добавление военного самолета";
buttonAddWarPlane.UseVisualStyleBackColor = true;
@ -103,9 +108,10 @@
//
// button1
//
button1.Location = new Point(6, 245);
button1.Location = new Point(7, 327);
button1.Margin = new Padding(3, 4, 3, 4);
button1.Name = "button1";
button1.Size = new Size(162, 30);
button1.Size = new Size(185, 40);
button1.TabIndex = 6;
button1.Text = "Обновить";
button1.UseVisualStyleBackColor = true;
@ -113,9 +119,10 @@
//
// buttonAddAirFighter
//
buttonAddAirFighter.Location = new Point(6, 61);
buttonAddAirFighter.Location = new Point(7, 81);
buttonAddAirFighter.Margin = new Padding(3, 4, 3, 4);
buttonAddAirFighter.Name = "buttonAddAirFighter";
buttonAddAirFighter.Size = new Size(162, 44);
buttonAddAirFighter.Size = new Size(185, 59);
buttonAddAirFighter.TabIndex = 2;
buttonAddAirFighter.Text = "Добавление истребителя";
buttonAddAirFighter.UseVisualStyleBackColor = true;
@ -123,18 +130,20 @@
//
// maskedTextBoxPosition
//
maskedTextBoxPosition.Location = new Point(8, 111);
maskedTextBoxPosition.Location = new Point(9, 148);
maskedTextBoxPosition.Margin = new Padding(3, 4, 3, 4);
maskedTextBoxPosition.Mask = "00";
maskedTextBoxPosition.Name = "maskedTextBoxPosition";
maskedTextBoxPosition.Size = new Size(162, 23);
maskedTextBoxPosition.Size = new Size(185, 27);
maskedTextBoxPosition.TabIndex = 3;
maskedTextBoxPosition.ValidatingType = typeof(int);
//
// buttonGoToCheck
//
buttonGoToCheck.Location = new Point(6, 195);
buttonGoToCheck.Location = new Point(7, 260);
buttonGoToCheck.Margin = new Padding(3, 4, 3, 4);
buttonGoToCheck.Name = "buttonGoToCheck";
buttonGoToCheck.Size = new Size(162, 44);
buttonGoToCheck.Size = new Size(185, 59);
buttonGoToCheck.TabIndex = 5;
buttonGoToCheck.Text = "Передать на тест";
buttonGoToCheck.UseVisualStyleBackColor = true;
@ -142,9 +151,10 @@
//
// buttonCreateCompany
//
buttonCreateCompany.Location = new Point(6, 344);
buttonCreateCompany.Location = new Point(7, 459);
buttonCreateCompany.Margin = new Padding(3, 4, 3, 4);
buttonCreateCompany.Name = "buttonCreateCompany";
buttonCreateCompany.Size = new Size(162, 23);
buttonCreateCompany.Size = new Size(185, 31);
buttonCreateCompany.TabIndex = 8;
buttonCreateCompany.Text = "Создать компанию";
buttonCreateCompany.UseVisualStyleBackColor = true;
@ -160,16 +170,18 @@
panelStorage.Controls.Add(textBoxCollectionName);
panelStorage.Controls.Add(labelCollectionName);
panelStorage.Dock = DockStyle.Top;
panelStorage.Location = new Point(3, 19);
panelStorage.Location = new Point(3, 24);
panelStorage.Margin = new Padding(3, 4, 3, 4);
panelStorage.Name = "panelStorage";
panelStorage.Size = new Size(168, 271);
panelStorage.Size = new Size(193, 361);
panelStorage.TabIndex = 7;
//
// buttonCollectionRemove
//
buttonCollectionRemove.Location = new Point(3, 210);
buttonCollectionRemove.Location = new Point(3, 280);
buttonCollectionRemove.Margin = new Padding(3, 4, 3, 4);
buttonCollectionRemove.Name = "buttonCollectionRemove";
buttonCollectionRemove.Size = new Size(162, 23);
buttonCollectionRemove.Size = new Size(185, 31);
buttonCollectionRemove.TabIndex = 6;
buttonCollectionRemove.Text = "Удалить коллекцию";
buttonCollectionRemove.UseVisualStyleBackColor = true;
@ -178,17 +190,18 @@
// listBoxCollection
//
listBoxCollection.FormattingEnabled = true;
listBoxCollection.ItemHeight = 15;
listBoxCollection.Location = new Point(3, 110);
listBoxCollection.Location = new Point(3, 147);
listBoxCollection.Margin = new Padding(3, 4, 3, 4);
listBoxCollection.Name = "listBoxCollection";
listBoxCollection.Size = new Size(162, 94);
listBoxCollection.Size = new Size(185, 124);
listBoxCollection.TabIndex = 5;
//
// buttonCollectionAdd
//
buttonCollectionAdd.Location = new Point(3, 81);
buttonCollectionAdd.Location = new Point(3, 108);
buttonCollectionAdd.Margin = new Padding(3, 4, 3, 4);
buttonCollectionAdd.Name = "buttonCollectionAdd";
buttonCollectionAdd.Size = new Size(162, 23);
buttonCollectionAdd.Size = new Size(185, 31);
buttonCollectionAdd.TabIndex = 4;
buttonCollectionAdd.Text = "Добавить коллекцию";
buttonCollectionAdd.UseVisualStyleBackColor = true;
@ -197,9 +210,10 @@
// radioButtonList
//
radioButtonList.AutoSize = true;
radioButtonList.Location = new Point(92, 56);
radioButtonList.Location = new Point(105, 75);
radioButtonList.Margin = new Padding(3, 4, 3, 4);
radioButtonList.Name = "radioButtonList";
radioButtonList.Size = new Size(66, 19);
radioButtonList.Size = new Size(80, 24);
radioButtonList.TabIndex = 3;
radioButtonList.TabStop = true;
radioButtonList.Text = "Список";
@ -208,9 +222,10 @@
// radioButtonMassive
//
radioButtonMassive.AutoSize = true;
radioButtonMassive.Location = new Point(3, 56);
radioButtonMassive.Location = new Point(3, 75);
radioButtonMassive.Margin = new Padding(3, 4, 3, 4);
radioButtonMassive.Name = "radioButtonMassive";
radioButtonMassive.Size = new Size(67, 19);
radioButtonMassive.Size = new Size(82, 24);
radioButtonMassive.TabIndex = 2;
radioButtonMassive.TabStop = true;
radioButtonMassive.Text = "Массив";
@ -218,17 +233,18 @@
//
// textBoxCollectionName
//
textBoxCollectionName.Location = new Point(3, 27);
textBoxCollectionName.Location = new Point(3, 36);
textBoxCollectionName.Margin = new Padding(3, 4, 3, 4);
textBoxCollectionName.Name = "textBoxCollectionName";
textBoxCollectionName.Size = new Size(162, 23);
textBoxCollectionName.Size = new Size(185, 27);
textBoxCollectionName.TabIndex = 1;
//
// labelCollectionName
//
labelCollectionName.AutoSize = true;
labelCollectionName.Location = new Point(21, 9);
labelCollectionName.Location = new Point(24, 12);
labelCollectionName.Name = "labelCollectionName";
labelCollectionName.Size = new Size(125, 15);
labelCollectionName.Size = new Size(158, 20);
labelCollectionName.TabIndex = 0;
labelCollectionName.Text = "Название коллекции:";
//
@ -238,9 +254,10 @@
comboBoxSelectorCompany.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxSelectorCompany.FormattingEnabled = true;
comboBoxSelectorCompany.Items.AddRange(new object[] { "Хранилище" });
comboBoxSelectorCompany.Location = new Point(6, 312);
comboBoxSelectorCompany.Location = new Point(7, 416);
comboBoxSelectorCompany.Margin = new Padding(3, 4, 3, 4);
comboBoxSelectorCompany.Name = "comboBoxSelectorCompany";
comboBoxSelectorCompany.Size = new Size(162, 23);
comboBoxSelectorCompany.Size = new Size(185, 28);
comboBoxSelectorCompany.TabIndex = 0;
comboBoxSelectorCompany.SelectedIndexChanged += ComboBoxSelectorCompany_SelectedIndexChanged;
//
@ -248,18 +265,21 @@
//
pictureBox.Dock = DockStyle.Fill;
pictureBox.Location = new Point(0, 0);
pictureBox.Margin = new Padding(3, 4, 3, 4);
pictureBox.Name = "pictureBox";
pictureBox.Size = new Size(659, 663);
pictureBox.Size = new Size(753, 884);
pictureBox.TabIndex = 1;
pictureBox.TabStop = false;
//
// FormWarPlaneCollection
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(833, 663);
ClientSize = new Size(952, 884);
Controls.Add(pictureBox);
Controls.Add(groupBox1);
Margin = new Padding(3, 4, 3, 4);
Name = "FormWarPlaneCollection";
Text = "Коллекция военных самолетов";
groupBox1.ResumeLayout(false);

View File

@ -19,7 +19,7 @@ public partial class FormWarPlaneCollection : Form
/// Хранилище коолекций
/// </summary>
private readonly StorageCollection<DrawningWarPlane> _storageCollection;
/// <summary>
/// Компания
/// </summary>
@ -59,8 +59,7 @@ public partial class FormWarPlaneCollection : Form
break;
case nameof(DrawningAirFighter):
drawningWarPlane = new DrawningAirFighter(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)),
GetColor(random),GetColor(random),
Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)));
break;
default:
@ -171,7 +170,7 @@ public partial class FormWarPlaneCollection : Form
/// <param name="e"></param>
private void buttonCollectionAdd_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(textBoxCollectionName.Text) ||(!radioButtonList.Checked && !radioButtonMassive.Checked))
if (string.IsNullOrEmpty(textBoxCollectionName.Text) || (!radioButtonList.Checked && !radioButtonMassive.Checked))
{
MessageBox.Show("Не все данные заполнены", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
@ -243,7 +242,7 @@ public partial class FormWarPlaneCollection : Form
MessageBox.Show("Коллекция не проинициализирована");
return;
}
switch (comboBoxSelectorCompany.Text)
{
case "Хранилище":
@ -251,11 +250,13 @@ public partial class FormWarPlaneCollection : Form
pictureBox.Height, collection);
break;
}
panelCompanyTools.Enabled = true;
RerfreshListBoxItems();
}
}