Жесткое исправление
This commit is contained in:
parent
0a429ba03b
commit
10a65bacae
@ -1,7 +1,7 @@
|
|||||||
namespace ProjectGasolineTanker.CollectionGenericObjects;
|
namespace ProjectGasolineTanker.CollectionGenericObjects;
|
||||||
using ProjectGasolineTanker.Drawnings;
|
using ProjectGasolineTanker.Drawnings;
|
||||||
|
|
||||||
public class CarSharingService : AbstractCompany
|
public class CarPark : AbstractCompany
|
||||||
{
|
{
|
||||||
private List<Tuple<int, int>> locCoord = new List<Tuple<int, int>>();
|
private List<Tuple<int, int>> locCoord = new List<Tuple<int, int>>();
|
||||||
private int numRows, numCols;
|
private int numRows, numCols;
|
||||||
@ -11,17 +11,14 @@ public class CarSharingService : AbstractCompany
|
|||||||
/// <param name="picWidth"></param>
|
/// <param name="picWidth"></param>
|
||||||
/// <param name="picHeight"></param>
|
/// <param name="picHeight"></param>
|
||||||
/// <param name="collection"></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)
|
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);
|
Pen pen = new Pen(Color.Brown, 3);
|
||||||
int offsetX = 10, offsetY = -12;
|
int offsetX = 10, offsetY = -12;
|
||||||
int x = 1 + offsetX, y = _pictureHeight - _placeSizeHeight + offsetY;
|
int x = 1 + offsetX, y = _pictureHeight - _placeSizeHeight + offsetY;
|
||||||
@ -50,7 +47,7 @@ public class CarSharingService : AbstractCompany
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int row = numRows - 1, col = numCols;
|
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)?.SetPictureSize(_pictureWidth, _pictureHeight);
|
||||||
_collection?.Get(i)?.SetPosition(locCoord[row * numCols - col].Item1 + 5, locCoord[row * numCols - col].Item2 + 9);
|
_collection?.Get(i)?.SetPosition(locCoord[row * numCols - col].Item1 + 5, locCoord[row * numCols - col].Item2 + 9);
|
@ -8,7 +8,7 @@ where T : class
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private T?[] _collection;
|
private T?[] _collection;
|
||||||
|
|
||||||
public int Count => _collection.Length;
|
public int Count => _collection.Length;
|
||||||
|
|
||||||
public int SetMaxCount
|
public int SetMaxCount
|
||||||
{
|
{
|
||||||
|
@ -32,7 +32,7 @@ public partial class FormTankerCollection : Form
|
|||||||
switch (comboBoxSelectorCompany.Text)
|
switch (comboBoxSelectorCompany.Text)
|
||||||
{
|
{
|
||||||
case "Хранилище":
|
case "Хранилище":
|
||||||
_company = new CarSharingService(pictureBox.Width, pictureBox.Height, new MassiveGenericObjects<DrawningTanker>());
|
_company = new CarPark(pictureBox.Width, pictureBox.Height, new MassiveGenericObjects<DrawningTanker>());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -125,7 +125,7 @@ public partial class FormTankerCollection : Form
|
|||||||
}
|
}
|
||||||
|
|
||||||
int pos = Convert.ToInt32(maskedTextBoxPosition.Text);
|
int pos = Convert.ToInt32(maskedTextBoxPosition.Text);
|
||||||
if (_company - pos)
|
if (_company - pos != null)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Объект удален");
|
MessageBox.Show("Объект удален");
|
||||||
pictureBox.Image = _company.Show();
|
pictureBox.Image = _company.Show();
|
||||||
|
@ -11,7 +11,7 @@ namespace ProjectGasolineTanker
|
|||||||
// 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 FormGasolineTanker());
|
Application.Run(new FormTankerCollection());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user