From 10a65bacaefa416eeb44e4b367898f59f907291e Mon Sep 17 00:00:00 2001 From: Roman-Klemendeev <147613551+Roman-Klemendeev@users.noreply.github.com> Date: Thu, 18 Apr 2024 01:07:33 +0400 Subject: [PATCH] =?UTF-8?q?=D0=96=D0=B5=D1=81=D1=82=D0=BA=D0=BE=D0=B5=20?= =?UTF-8?q?=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{CarSharingService.cs => CarPark.cs} | 15 ++++++--------- .../MassiveGenericObjects.cs | 2 +- .../ProjectGasolineTanker/FormTankerCollection.cs | 4 ++-- .../ProjectGasolineTanker/Program.cs | 2 +- 4 files changed, 10 insertions(+), 13 deletions(-) rename ProjectGasolineTanker/ProjectGasolineTanker/CollectionGenericObjects/{CarSharingService.cs => CarPark.cs} (78%) diff --git a/ProjectGasolineTanker/ProjectGasolineTanker/CollectionGenericObjects/CarSharingService.cs b/ProjectGasolineTanker/ProjectGasolineTanker/CollectionGenericObjects/CarPark.cs similarity index 78% rename from ProjectGasolineTanker/ProjectGasolineTanker/CollectionGenericObjects/CarSharingService.cs rename to ProjectGasolineTanker/ProjectGasolineTanker/CollectionGenericObjects/CarPark.cs index ee35f96..490d9f6 100644 --- a/ProjectGasolineTanker/ProjectGasolineTanker/CollectionGenericObjects/CarSharingService.cs +++ b/ProjectGasolineTanker/ProjectGasolineTanker/CollectionGenericObjects/CarPark.cs @@ -1,7 +1,7 @@ namespace ProjectGasolineTanker.CollectionGenericObjects; using ProjectGasolineTanker.Drawnings; -public class CarSharingService : AbstractCompany +public class CarPark : AbstractCompany { private List> locCoord = new List>(); private int numRows, numCols; @@ -11,17 +11,14 @@ public class CarSharingService : AbstractCompany /// /// /// - public CarSharingService(int picWidth, int picHeight, ICollectionGenericObjects collection) : base(picWidth, picHeight, collection) + public CarPark(int picWidth, int picHeight, ICollectionGenericObjects collection) : base(picWidth, picHeight, collection) { } protected override void DrawBackground(Graphics g) { - Color backgroundColor = Color.SkyBlue; - using (Brush brush = new SolidBrush(backgroundColor)) - { - g.FillRectangle(brush, new Rectangle(0, 0, _pictureWidth, _pictureHeight)); - } + + Pen pen = new Pen(Color.Brown, 3); int offsetX = 10, offsetY = -12; int x = 1 + offsetX, y = _pictureHeight - _placeSizeHeight + offsetY; @@ -50,7 +47,7 @@ public class CarSharingService : AbstractCompany return; } int row = numRows - 1, col = numCols; - for (int i = 0; i < _collection?.Count; i++, col--) + for (int i = 0; i < _collection?.Count-4; i++, col--) { _collection?.Get(i)?.SetPictureSize(_pictureWidth, _pictureHeight); _collection?.Get(i)?.SetPosition(locCoord[row * numCols - col].Item1 + 5, locCoord[row * numCols - col].Item2 + 9); @@ -61,4 +58,4 @@ public class CarSharingService : AbstractCompany } } } -} +} \ No newline at end of file diff --git a/ProjectGasolineTanker/ProjectGasolineTanker/CollectionGenericObjects/MassiveGenericObjects.cs b/ProjectGasolineTanker/ProjectGasolineTanker/CollectionGenericObjects/MassiveGenericObjects.cs index 35cdc54..7c28554 100644 --- a/ProjectGasolineTanker/ProjectGasolineTanker/CollectionGenericObjects/MassiveGenericObjects.cs +++ b/ProjectGasolineTanker/ProjectGasolineTanker/CollectionGenericObjects/MassiveGenericObjects.cs @@ -8,7 +8,7 @@ where T : class /// private T?[] _collection; - public int Count => _collection.Length; + public int Count => _collection.Length; public int SetMaxCount { diff --git a/ProjectGasolineTanker/ProjectGasolineTanker/FormTankerCollection.cs b/ProjectGasolineTanker/ProjectGasolineTanker/FormTankerCollection.cs index e2010d1..7320eaa 100644 --- a/ProjectGasolineTanker/ProjectGasolineTanker/FormTankerCollection.cs +++ b/ProjectGasolineTanker/ProjectGasolineTanker/FormTankerCollection.cs @@ -32,7 +32,7 @@ public partial class FormTankerCollection : Form switch (comboBoxSelectorCompany.Text) { case "Хранилище": - _company = new CarSharingService(pictureBox.Width, pictureBox.Height, new MassiveGenericObjects()); + _company = new CarPark(pictureBox.Width, pictureBox.Height, new MassiveGenericObjects()); break; } } @@ -125,7 +125,7 @@ public partial class FormTankerCollection : Form } int pos = Convert.ToInt32(maskedTextBoxPosition.Text); - if (_company - pos) + if (_company - pos != null) { MessageBox.Show("Объект удален"); pictureBox.Image = _company.Show(); diff --git a/ProjectGasolineTanker/ProjectGasolineTanker/Program.cs b/ProjectGasolineTanker/ProjectGasolineTanker/Program.cs index 12d41fa..913060e 100644 --- a/ProjectGasolineTanker/ProjectGasolineTanker/Program.cs +++ b/ProjectGasolineTanker/ProjectGasolineTanker/Program.cs @@ -11,7 +11,7 @@ namespace ProjectGasolineTanker // To customize application configuration such as set high DPI settings or default font, // see https://aka.ms/applicationconfiguration. ApplicationConfiguration.Initialize(); - Application.Run(new FormGasolineTanker()); + Application.Run(new FormTankerCollection()); } } } \ No newline at end of file