diff --git a/ProjectLiner/ProjectLiner/DrawningLiner.cs b/ProjectLiner/ProjectLiner/DrawningLiner.cs
index 76d0856..d5023a3 100644
--- a/ProjectLiner/ProjectLiner/DrawningLiner.cs
+++ b/ProjectLiner/ProjectLiner/DrawningLiner.cs
@@ -33,7 +33,7 @@ public class DrawningLiner
///
/// Ширина прорисовки лайнера
///
- private readonly int _drawningLinerWidth = 180;
+ private readonly int _drawningLinerWidth = 150;
///
/// Высота прорисовки лайнера
@@ -68,9 +68,29 @@ public class DrawningLiner
/// true - границы заданы, false - проверка не пройдена, нельзя разместить объект в этих размерах
public bool SetPictureSize(int width, int height)
{
- _pictureWidth = width;
- _pictureHeight = height;
- return true;
+ if (width > _drawningLinerWidth && height > _drawningLinerHeight)
+ {
+ _pictureWidth = width;
+ _pictureHeight = height;
+ if (_startPosX != null && _startPosY != null)
+ {
+ if (_startPosX.Value < 0)
+ _startPosX = 0;
+ if (_startPosY.Value < 0)
+ _startPosY = 0;
+ if (_startPosX.Value + _drawningLinerWidth > _pictureWidth)
+ {
+ _startPosX = _pictureWidth - _drawningLinerWidth;
+ }
+ if (_startPosY.Value + _drawningLinerHeight > _pictureHeight)
+ {
+ _startPosY = _pictureHeight - _drawningLinerHeight;
+ }
+ }
+
+ return true;
+ }
+ return false;
}
///
@@ -84,16 +104,22 @@ public class DrawningLiner
{
return;
}
-
- if (x < 0 || y < 0)
+ else
{
- return;
+ _startPosX = x;
+ _startPosY = y;
+
+ if (_startPosX.Value + _drawningLinerWidth > _pictureWidth)
+ {
+ _startPosX = _pictureWidth - _drawningLinerWidth;
+ }
+ if (_startPosY.Value + _drawningLinerHeight > _pictureHeight)
+ {
+ _startPosY = _pictureHeight - _drawningLinerHeight;
+ }
}
- _startPosX = x;
- _startPosY = y;
}
-
///
/// Изменение направления перемещения
///
@@ -169,7 +195,7 @@ public class DrawningLiner
Point point1 = new Point(_startPosX.Value, _startPosY.Value + 80);
Point point2 = new Point(_startPosX.Value + 50, _startPosY.Value + 130);
Point point3 = new Point(_startPosX.Value + 135, _startPosY.Value + 130);
- Point point4 = new Point(_startPosX.Value + 185, _startPosY.Value + 80);
+ Point point4 = new Point(_startPosX.Value + 155, _startPosY.Value + 80);
Point[] curvePoints = { point1, point2, point3, point4 };
g.FillPolygon(br, curvePoints);
@@ -185,9 +211,9 @@ public class DrawningLiner
// шлюпки
if (EntityLiner.Boats)
{
- g.FillEllipse(additionalBrush, _startPosX.Value + 60, _startPosY.Value + 85, 30, 15);
- g.FillEllipse(additionalBrush, _startPosX.Value + 95, _startPosY.Value + 85, 30, 15);
- g.FillEllipse(additionalBrush, _startPosX.Value + 130, _startPosY.Value + 85, 30, 15);
+ g.FillEllipse(additionalBrush, _startPosX.Value + 40, _startPosY.Value + 85, 30, 15);
+ g.FillEllipse(additionalBrush, _startPosX.Value + 75, _startPosY.Value + 85, 30, 15);
+ g.FillEllipse(additionalBrush, _startPosX.Value + 110, _startPosY.Value + 85, 30, 15);
}
// труба
diff --git a/ProjectLiner/ProjectLiner/FormLiner.Designer.cs b/ProjectLiner/ProjectLiner/FormLiner.Designer.cs
index e55a740..94eb653 100644
--- a/ProjectLiner/ProjectLiner/FormLiner.Designer.cs
+++ b/ProjectLiner/ProjectLiner/FormLiner.Designer.cs
@@ -39,6 +39,7 @@
//
// pictureBoxLiner
//
+ pictureBoxLiner.BackColor = SystemColors.Control;
pictureBoxLiner.Dock = DockStyle.Fill;
pictureBoxLiner.Location = new Point(0, 0);
pictureBoxLiner.Name = "pictureBoxLiner";
@@ -48,6 +49,7 @@
//
// buttonCreate
//
+ buttonCreate.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
buttonCreate.Location = new Point(12, 520);
buttonCreate.Name = "buttonCreate";
buttonCreate.Size = new Size(150, 82);