diff --git a/ProjectAirPlane/ProjectAirPlane/CollectionGenericObjects/AbstractCompany.cs b/ProjectAirPlane/ProjectAirPlane/CollectionGenericObjects/AbstractCompany.cs index 3a34be8..a705d97 100644 --- a/ProjectAirPlane/ProjectAirPlane/CollectionGenericObjects/AbstractCompany.cs +++ b/ProjectAirPlane/ProjectAirPlane/CollectionGenericObjects/AbstractCompany.cs @@ -7,11 +7,11 @@ public abstract class AbstractCompany /// /// Размер места (ширина) /// - protected readonly int _placeSizeWidth = 210; + protected readonly int _placeSizeWidth = 195; /// /// Размер места (высота) /// - protected readonly int _placeSizeHeight = 80; + protected readonly int _placeSizeHeight = 70; /// /// Ширина окна /// diff --git a/ProjectAirPlane/ProjectAirPlane/CollectionGenericObjects/PlaneSharigService.cs b/ProjectAirPlane/ProjectAirPlane/CollectionGenericObjects/PlaneSharigService.cs index b0e0b8b..0fccf19 100644 --- a/ProjectAirPlane/ProjectAirPlane/CollectionGenericObjects/PlaneSharigService.cs +++ b/ProjectAirPlane/ProjectAirPlane/CollectionGenericObjects/PlaneSharigService.cs @@ -11,11 +11,48 @@ public class PlaneSharigService : AbstractCompany protected override void DrawBackgound(Graphics g) { - throw new NotImplementedException(); + + Pen pen = new(Color.Black, 3); + 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 / 2, j * + _placeSizeHeight); + } + g.DrawLine(pen, i * _placeSizeWidth, 0, i * + _placeSizeWidth, _pictureHeight / _placeSizeHeight * _placeSizeHeight); + } } protected override void SetObjectsPosition() { - throw new NotImplementedException(); + int width = _pictureWidth / _placeSizeWidth; + int height = _pictureHeight / _placeSizeHeight; + + int curWidth = width - 1; + 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 + 20, curHeight * _placeSizeHeight + 4); + } + if (curWidth > 0) + curWidth--; + else + { + curWidth = width - 1; + curHeight++; + } + if (curHeight > height) + { + return; + } + } } } diff --git a/ProjectAirPlane/ProjectAirPlane/FormPlaneCollection.Designer.cs b/ProjectAirPlane/ProjectAirPlane/FormPlaneCollection.Designer.cs index 947f70f..ae38492 100644 --- a/ProjectAirPlane/ProjectAirPlane/FormPlaneCollection.Designer.cs +++ b/ProjectAirPlane/ProjectAirPlane/FormPlaneCollection.Designer.cs @@ -118,7 +118,7 @@ buttonAddPlane.Name = "buttonAddPlane"; buttonAddPlane.Size = new Size(186, 50); buttonAddPlane.TabIndex = 1; - buttonAddPlane.Text = "Добавление самолёта"; + buttonAddPlane.Text = "Добавление судна"; buttonAddPlane.UseVisualStyleBackColor = true; buttonAddPlane.Click += ButtonAddPlane_Click; //