изменения.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; _pictureWidth = picWidth;
_pictureHeight = picHeight; _pictureHeight = picHeight;
_collection = collection; _collection = collection;
_collection.SetMaxCount = GetMaxCount - 3; _collection.SetMaxCount = GetMaxCount - 4;
} }
/// <summary> /// <summary>

View File

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

View File

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