LabWork03
This commit is contained in:
parent
1af20534c6
commit
bc5127d410
@ -10,7 +10,7 @@ namespace ProjectCatamaran.CollectiongGenericObjects;
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Реализация абстрактной компании - каршеринг
|
/// Реализация абстрактной компании - каршеринг
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class BoatSharingService : AbstractCompany
|
public class BoatHarborService : AbstractCompany
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
@ -18,7 +18,7 @@ public class BoatSharingService : 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 BoatSharingService(int picWidth, int picHeight, ICollectionGenericObjects<DrawningBoat> collection) : base(picWidth, picHeight, collection)
|
public BoatHarborService(int picWidth, int picHeight, ICollectionGenericObjects<DrawningBoat> collection) : base(picWidth, picHeight, collection)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,14 +26,14 @@ public class BoatSharingService : AbstractCompany
|
|||||||
{
|
{
|
||||||
int width = _pictureWidth / _placeSizeWidth;
|
int width = _pictureWidth / _placeSizeWidth;
|
||||||
int height = _pictureHeight / _placeSizeHeight;
|
int height = _pictureHeight / _placeSizeHeight;
|
||||||
Pen pen = new(Color.Black, 2);
|
Pen pen = new(Color.Black, 4);
|
||||||
for (int i = 0; i < width; i++)
|
for (int i = 0; i < _pictureWidth / _placeSizeWidth; i++)
|
||||||
{
|
{
|
||||||
for (int j = 0; j < height + 1; ++j)
|
for (int j = 0; j < _pictureHeight / _placeSizeHeight + 1; ++j)
|
||||||
{
|
{
|
||||||
g.DrawLine(pen, i * _placeSizeWidth, j * _placeSizeHeight, i * _placeSizeWidth + _placeSizeWidth - 20, j * _placeSizeHeight);
|
g.DrawLine(pen, i * _placeSizeWidth, j * _placeSizeHeight + 5, i * _placeSizeWidth + _placeSizeWidth - 90, j * _placeSizeHeight + 5);
|
||||||
g.DrawLine(pen, i * _placeSizeWidth + _placeSizeWidth - 20, j * _placeSizeHeight, i * _placeSizeWidth + _placeSizeWidth - 20, j * _placeSizeHeight + _placeSizeHeight);
|
|
||||||
}
|
}
|
||||||
|
g.DrawLine(pen, i * _placeSizeWidth,0, i * _placeSizeWidth, _pictureHeight / _placeSizeHeight * _placeSizeHeight + 5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,14 +43,14 @@ public class BoatSharingService : AbstractCompany
|
|||||||
int height = _pictureHeight / _placeSizeHeight;
|
int height = _pictureHeight / _placeSizeHeight;
|
||||||
|
|
||||||
int curWidth = 0;
|
int curWidth = 0;
|
||||||
int curHeight = 0;
|
int curHeight = height - 1;
|
||||||
|
|
||||||
for (int i = 0; i < (_collection?.Count ?? 0); i++)
|
for (int i = 0; i < (_collection?.Count ?? 0); i++)
|
||||||
{
|
{
|
||||||
if (_collection.Get(i) != null)
|
if (_collection.Get(i) != null)
|
||||||
{
|
{
|
||||||
_collection.Get(i).SetPictureSize(_pictureWidth, _pictureHeight);
|
_collection.Get(i).SetPictureSize(_pictureWidth, _pictureHeight);
|
||||||
_collection.Get(i).SetPosition(_placeSizeWidth * curWidth + 30, curHeight * _placeSizeHeight);
|
_collection.Get(i).SetPosition(_placeSizeWidth * curWidth + 10, curHeight * _placeSizeHeight + 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (curWidth < width - 1)
|
if (curWidth < width - 1)
|
||||||
@ -58,10 +58,9 @@ public class BoatSharingService : AbstractCompany
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
curWidth = 0;
|
curWidth = 0;
|
||||||
curHeight++;
|
curHeight--;
|
||||||
}
|
}
|
||||||
|
if (curHeight < 0)
|
||||||
if (curHeight >= height)
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
@ -51,9 +51,9 @@
|
|||||||
groupBoxTools.Controls.Add(buttonAddBoat);
|
groupBoxTools.Controls.Add(buttonAddBoat);
|
||||||
groupBoxTools.Controls.Add(comboBoxSelectorCompany);
|
groupBoxTools.Controls.Add(comboBoxSelectorCompany);
|
||||||
groupBoxTools.Dock = DockStyle.Right;
|
groupBoxTools.Dock = DockStyle.Right;
|
||||||
groupBoxTools.Location = new Point(728, 0);
|
groupBoxTools.Location = new Point(849, 0);
|
||||||
groupBoxTools.Name = "groupBoxTools";
|
groupBoxTools.Name = "groupBoxTools";
|
||||||
groupBoxTools.Size = new Size(279, 633);
|
groupBoxTools.Size = new Size(279, 629);
|
||||||
groupBoxTools.TabIndex = 0;
|
groupBoxTools.TabIndex = 0;
|
||||||
groupBoxTools.TabStop = false;
|
groupBoxTools.TabStop = false;
|
||||||
groupBoxTools.Text = "Инструменты";
|
groupBoxTools.Text = "Инструменты";
|
||||||
@ -140,7 +140,7 @@
|
|||||||
pictureBoxBoat.Dock = DockStyle.Fill;
|
pictureBoxBoat.Dock = DockStyle.Fill;
|
||||||
pictureBoxBoat.Location = new Point(0, 0);
|
pictureBoxBoat.Location = new Point(0, 0);
|
||||||
pictureBoxBoat.Name = "pictureBoxBoat";
|
pictureBoxBoat.Name = "pictureBoxBoat";
|
||||||
pictureBoxBoat.Size = new Size(728, 633);
|
pictureBoxBoat.Size = new Size(849, 629);
|
||||||
pictureBoxBoat.TabIndex = 1;
|
pictureBoxBoat.TabIndex = 1;
|
||||||
pictureBoxBoat.TabStop = false;
|
pictureBoxBoat.TabStop = false;
|
||||||
//
|
//
|
||||||
@ -148,7 +148,7 @@
|
|||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(1007, 633);
|
ClientSize = new Size(1128, 629);
|
||||||
Controls.Add(pictureBoxBoat);
|
Controls.Add(pictureBoxBoat);
|
||||||
Controls.Add(groupBoxTools);
|
Controls.Add(groupBoxTools);
|
||||||
Name = "FormBoatCollection";
|
Name = "FormBoatCollection";
|
||||||
|
@ -37,7 +37,7 @@ public partial class FormBoatCollection : Form
|
|||||||
switch (comboBoxSelectorCompany.Text)
|
switch (comboBoxSelectorCompany.Text)
|
||||||
{
|
{
|
||||||
case "Хранилище":
|
case "Хранилище":
|
||||||
_company = new BoatSharingService(pictureBoxBoat.Width,
|
_company = new BoatHarborService(pictureBoxBoat.Width,
|
||||||
pictureBoxBoat.Height, new MassiveGenericObjects<DrawningBoat>());
|
pictureBoxBoat.Height, new MassiveGenericObjects<DrawningBoat>());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -123,19 +123,21 @@ public partial class FormBoatCollection : Form
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (MessageBox.Show("удалить объект?", "удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
|
|
||||||
|
if (MessageBox.Show("Удалить объект?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int pos = Convert.ToInt32(maskedTextBoxPosition.Text);
|
int pos = Convert.ToInt32(maskedTextBoxPosition.Text);
|
||||||
if (_company - pos != null)
|
if (_company - pos != null)
|
||||||
{
|
{
|
||||||
MessageBox.Show("объект удален");
|
MessageBox.Show("Объект удален");
|
||||||
pictureBoxBoat.Image = _company.Show();
|
pictureBoxBoat.Image = _company.Show();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MessageBox.Show("не удалось удалить объект");
|
MessageBox.Show("Не удалось удалить объект");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user