Точно рабочая лаба 7

This commit is contained in:
Павел Ладягин 2024-05-14 20:44:10 +04:00
parent 6bc99aa840
commit 99c2285250
5 changed files with 11 additions and 12 deletions

View File

@ -36,7 +36,7 @@ namespace ProjectAirplaneWithRadar.CollectionGenericObjects
/// <summary> /// <summary>
/// Вычисление максимального количества элементов, который можно разместить в окне /// Вычисление максимального количества элементов, который можно разместить в окне
/// </summary> /// </summary>
private int GetMaxCount => _pictureWidth * _pictureHeight / (_placeSizeWidth * _placeSizeHeight); private int GetMaxCount => _pictureWidth / _placeSizeWidth * (_pictureHeight / _placeSizeHeight);
/// <summary> /// <summary>
/// Конструктор /// Конструктор

View File

@ -74,7 +74,7 @@ namespace ProjectAirplaneWithRadar.CollectionGenericObjects
public int Insert(T obj, int position) public int Insert(T obj, int position)
{ {
if (position < 0 || position >= Count) if (position >= Count || position < 0)
throw new PositionOutOfCollectionException(position); throw new PositionOutOfCollectionException(position);
if (_collection[position] == null) if (_collection[position] == null)

View File

@ -58,7 +58,6 @@ namespace ProjectAirplaneWithRadar.CollectionGenericObjects
{ {
break; break;
} }
} }
} }
} }

View File

@ -66,9 +66,9 @@
groupBoxTools.Controls.Add(panelStorage); groupBoxTools.Controls.Add(panelStorage);
groupBoxTools.Controls.Add(comboBoxSelectorCompany); groupBoxTools.Controls.Add(comboBoxSelectorCompany);
groupBoxTools.Dock = DockStyle.Right; groupBoxTools.Dock = DockStyle.Right;
groupBoxTools.Location = new Point(883, 24); groupBoxTools.Location = new Point(445, 24);
groupBoxTools.Name = "groupBoxTools"; groupBoxTools.Name = "groupBoxTools";
groupBoxTools.Size = new Size(206, 583); groupBoxTools.Size = new Size(206, 523);
groupBoxTools.TabIndex = 0; groupBoxTools.TabIndex = 0;
groupBoxTools.TabStop = false; groupBoxTools.TabStop = false;
groupBoxTools.Text = "Инструменты"; groupBoxTools.Text = "Инструменты";
@ -82,7 +82,7 @@
panelCompanyTools.Controls.Add(buttonGoToCheck); panelCompanyTools.Controls.Add(buttonGoToCheck);
panelCompanyTools.Dock = DockStyle.Bottom; panelCompanyTools.Dock = DockStyle.Bottom;
panelCompanyTools.Enabled = false; panelCompanyTools.Enabled = false;
panelCompanyTools.Location = new Point(3, 393); panelCompanyTools.Location = new Point(3, 333);
panelCompanyTools.Name = "panelCompanyTools"; panelCompanyTools.Name = "panelCompanyTools";
panelCompanyTools.Size = new Size(200, 187); panelCompanyTools.Size = new Size(200, 187);
panelCompanyTools.TabIndex = 8; panelCompanyTools.TabIndex = 8;
@ -249,7 +249,7 @@
pictureBox.Dock = DockStyle.Fill; pictureBox.Dock = DockStyle.Fill;
pictureBox.Location = new Point(0, 24); pictureBox.Location = new Point(0, 24);
pictureBox.Name = "pictureBox"; pictureBox.Name = "pictureBox";
pictureBox.Size = new Size(883, 583); pictureBox.Size = new Size(445, 523);
pictureBox.TabIndex = 1; pictureBox.TabIndex = 1;
pictureBox.TabStop = false; pictureBox.TabStop = false;
// //
@ -258,7 +258,7 @@
menuStrip.Items.AddRange(new ToolStripItem[] { файлToolStripMenuItem }); menuStrip.Items.AddRange(new ToolStripItem[] { файлToolStripMenuItem });
menuStrip.Location = new Point(0, 0); menuStrip.Location = new Point(0, 0);
menuStrip.Name = "menuStrip"; menuStrip.Name = "menuStrip";
menuStrip.Size = new Size(1089, 24); menuStrip.Size = new Size(651, 24);
menuStrip.TabIndex = 2; menuStrip.TabIndex = 2;
menuStrip.Text = "menuStrip"; menuStrip.Text = "menuStrip";
// //
@ -297,7 +297,7 @@
// //
AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(1089, 607); ClientSize = new Size(651, 547);
Controls.Add(pictureBox); Controls.Add(pictureBox);
Controls.Add(groupBoxTools); Controls.Add(groupBoxTools);
Controls.Add(menuStrip); Controls.Add(menuStrip);

View File

@ -78,10 +78,10 @@ namespace ProjectAirplaneWithRadar
_logger.LogInformation("Добавлен объект: {0}", airplane.GetDataForSave()); _logger.LogInformation("Добавлен объект: {0}", airplane.GetDataForSave());
} }
} }
catch catch (CollectionOverflowException ex)
{ {
MessageBox.Show("Не удалось добавить объект"); MessageBox.Show(ex.Message);
_logger.LogError("Ошибка: В коллекции превышено допустимое количество"); _logger.LogError("Ошибка: {Message}", ex.Message);
} }
} }