Жесткое исправление

This commit is contained in:
Roman-Klemendeev 2024-04-18 01:07:33 +04:00
parent 0a429ba03b
commit 10a65bacae
4 changed files with 10 additions and 13 deletions

View File

@ -1,7 +1,7 @@
namespace ProjectGasolineTanker.CollectionGenericObjects;
using ProjectGasolineTanker.Drawnings;
public class CarSharingService : AbstractCompany
public class CarPark : AbstractCompany
{
private List<Tuple<int, int>> locCoord = new List<Tuple<int, int>>();
private int numRows, numCols;
@ -11,17 +11,14 @@ public class CarSharingService : AbstractCompany
/// <param name="picWidth"></param>
/// <param name="picHeight"></param>
/// <param name="collection"></param>
public CarSharingService(int picWidth, int picHeight, ICollectionGenericObjects<DrawningTanker> collection) : base(picWidth, picHeight, collection)
public CarPark(int picWidth, int picHeight, ICollectionGenericObjects<DrawningTanker> 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);

View File

@ -8,7 +8,7 @@ where T : class
/// </summary>
private T?[] _collection;
public int Count => _collection.Length;
public int Count => _collection.Length;
public int SetMaxCount
{

View File

@ -32,7 +32,7 @@ public partial class FormTankerCollection : Form
switch (comboBoxSelectorCompany.Text)
{
case "Хранилище":
_company = new CarSharingService(pictureBox.Width, pictureBox.Height, new MassiveGenericObjects<DrawningTanker>());
_company = new CarPark(pictureBox.Width, pictureBox.Height, new MassiveGenericObjects<DrawningTanker>());
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();

View File

@ -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());
}
}
}