Рабочая версия

This commit is contained in:
Павел Ладягин 2024-03-16 15:13:57 +04:00
parent c307fff27c
commit 0d20d952a8
5 changed files with 49 additions and 8 deletions

View File

@ -15,7 +15,7 @@ namespace ProjectAirplaneWithRadar.CollectionGenericObjects
/// <summary> /// <summary>
/// Размер места (высота) /// Размер места (высота)
/// </summary> /// </summary>
protected readonly int _placeSizeHeight = 80; protected readonly int _placeSizeHeight = 100;
/// <summary> /// <summary>
/// Ширина окна /// Ширина окна

View File

@ -12,12 +12,47 @@ namespace ProjectAirplaneWithRadar.CollectionGenericObjects
protected override void DrawBackgound(Graphics g) protected override void DrawBackgound(Graphics g)
{ {
throw new NotImplementedException(); Pen pen = new(Color.Black, 4);
for (int i = 0; i < _pictureWidth / _placeSizeWidth; i++)
{
for (int j = 0; j < _pictureHeight / _placeSizeHeight + 1; ++j)
{
g.DrawLine(pen, i * _placeSizeWidth, j * _placeSizeHeight,
i * _placeSizeWidth + _placeSizeWidth - 40, j * _placeSizeHeight);
}
g.DrawLine(pen, i * _placeSizeWidth, 0, i * _placeSizeWidth, _pictureHeight / _placeSizeHeight * _placeSizeHeight);
}
} }
protected override void SetObjectsPosition() protected override void SetObjectsPosition()
{ {
throw new NotImplementedException(); int width = _pictureWidth / _placeSizeWidth;
int height = _pictureHeight / _placeSizeHeight;
int curWidth = 0;
int curHeight = 0;
for (int i = 0; i < (_collection?.Count ?? 0); i++)
{
if (_collection.Get(i) != null)
{
_collection.Get(i).SetPictureSize(_pictureWidth, _pictureHeight);
_collection.Get(i).SetPosition(_placeSizeWidth * curWidth + 10, curHeight * _placeSizeHeight);
}
if (curWidth < width - 1)
curWidth++;
else
{
curWidth = 0;
curHeight++;
}
if (curHeight > height)
{
return;
}
}
} }
} }
} }

View File

@ -67,6 +67,7 @@
buttonRefresh.TabIndex = 6; buttonRefresh.TabIndex = 6;
buttonRefresh.Text = "Обновить"; buttonRefresh.Text = "Обновить";
buttonRefresh.UseVisualStyleBackColor = true; buttonRefresh.UseVisualStyleBackColor = true;
buttonRefresh.Click += ButtonRefresh_Click;
// //
// buttonGoToCheck // buttonGoToCheck
// //
@ -88,6 +89,7 @@
buttonRemoveAirplane.TabIndex = 4; buttonRemoveAirplane.TabIndex = 4;
buttonRemoveAirplane.Text = "Удалить самолет"; buttonRemoveAirplane.Text = "Удалить самолет";
buttonRemoveAirplane.UseVisualStyleBackColor = true; buttonRemoveAirplane.UseVisualStyleBackColor = true;
buttonRemoveAirplane.Click += ButtonRemoveAirplane_Click;
// //
// maskedTextBoxPosition // maskedTextBoxPosition
// //
@ -107,6 +109,7 @@
buttonAddAirplaneWithRadar.TabIndex = 2; buttonAddAirplaneWithRadar.TabIndex = 2;
buttonAddAirplaneWithRadar.Text = "Добавить самолет с радаром"; buttonAddAirplaneWithRadar.Text = "Добавить самолет с радаром";
buttonAddAirplaneWithRadar.UseVisualStyleBackColor = true; buttonAddAirplaneWithRadar.UseVisualStyleBackColor = true;
buttonAddAirplaneWithRadar.Click += ButtonAddAirplaneWithRadar_Click;
// //
// buttonAddAirplane // buttonAddAirplane
// //
@ -117,6 +120,7 @@
buttonAddAirplane.TabIndex = 1; buttonAddAirplane.TabIndex = 1;
buttonAddAirplane.Text = "Добавить самолет"; buttonAddAirplane.Text = "Добавить самолет";
buttonAddAirplane.UseVisualStyleBackColor = true; buttonAddAirplane.UseVisualStyleBackColor = true;
buttonAddAirplane.Click += ButtonAddAirplane_Click;
// //
// comboBoxSelectorCompany // comboBoxSelectorCompany
// //
@ -128,6 +132,7 @@
comboBoxSelectorCompany.Name = "comboBoxSelectorCompany"; comboBoxSelectorCompany.Name = "comboBoxSelectorCompany";
comboBoxSelectorCompany.Size = new Size(188, 23); comboBoxSelectorCompany.Size = new Size(188, 23);
comboBoxSelectorCompany.TabIndex = 0; comboBoxSelectorCompany.TabIndex = 0;
comboBoxSelectorCompany.Click += ComboBoxSelectorCompany_SelectedIndexChanged;
// //
// pictureBox // pictureBox
// //

View File

@ -53,11 +53,12 @@ namespace ProjectAirplaneWithRadar
case nameof(DrawningAirplane): case nameof(DrawningAirplane):
drawingAirplane = new DrawningAirplane(random.Next(100, 300), random.Next(1000, 3000), GetColor(random)); drawingAirplane = new DrawningAirplane(random.Next(100, 300), random.Next(1000, 3000), GetColor(random));
break; break;
case nameof(DrawingAirplaneWithRadar): case nameof(DrawingAirplaneWithRadar):
drawingAirplane = new DrawingAirplaneWithRadar(random.Next(100, 300), random.Next(1000, 3000), drawingAirplane = new DrawingAirplaneWithRadar(random.Next(100, 300), random.Next(1000, 3000),
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)), GetColor(random),
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)), GetColor(random),
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:
return; return;

View File

@ -11,7 +11,7 @@ namespace ProjectAirplaneWithRadar
// To customize application configuration such as set high DPI settings or default font, // To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration. // see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize(); ApplicationConfiguration.Initialize();
Application.Run(new FormAirplaneWithRadar()); Application.Run(new FormAirplaneCollection());
} }
} }
} }