diff --git a/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/DrawningBoat.cs b/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/DrawningBoat.cs
index b1bd3d4..707c66d 100644
--- a/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/DrawningBoat.cs
+++ b/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/DrawningBoat.cs
@@ -56,7 +56,7 @@ namespace PIbd_22_Kalyshev_Y_V_MotorBoat_Base
/// Высота картинки
public void SetPosition(int x, int y, int width, int height)
{
- if (x <= width || y <= height || _boatWidth <= width || _boatHeight <= height)
+ if (x + _boatWidth <= width && y + _boatHeight <= height && x > 0 && y > 0)
{
_startPosX = x;
_startPosY = y;
@@ -120,7 +120,6 @@ namespace PIbd_22_Kalyshev_Y_V_MotorBoat_Base
Pen pen = new(Color.Black, 3);
Brush br = new SolidBrush(Boat?.BodyColor ?? Color.Black);
Brush brBrown = new SolidBrush(Color.Brown);
-
// Внешняя часть лодки
g.DrawLine(pen, _startPosX, _startPosY, _startPosX + 120, _startPosY + 0);
g.DrawLine(pen, _startPosX + 120, _startPosY, _startPosX + 170, _startPosY + 30);
diff --git a/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/EntityBoat.cs b/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/EntityBoat.cs
index 3bd05df..2e68e8e 100644
--- a/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/EntityBoat.cs
+++ b/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/EntityBoat.cs
@@ -15,7 +15,7 @@ namespace PIbd_22_Kalyshev_Y_V_MotorBoat_Base
public void Init(int speed, float weight, Color bodyColor)
{
Random rnd = new();
- Speed = speed <= 0 ? rnd.Next(10, 80) : speed;
+ Speed = speed <= 0 ? rnd.Next(5, 30) : speed;
Weight = weight <= 0 ? rnd.Next(30, 100) : weight;
BodyColor = bodyColor;
}
diff --git a/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/FormBoat.Designer.cs b/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/FormBoat.Designer.cs
index e9ed7bc..39b526d 100644
--- a/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/FormBoat.Designer.cs
+++ b/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/FormBoat.Designer.cs
@@ -49,9 +49,9 @@
this.toolStripStatusLabelSpeed,
this.toolStripStatusLabelWeight,
this.toolStripStatusLabelBodyColor});
- this.statusStrip1.Location = new System.Drawing.Point(0, 424);
+ this.statusStrip1.Location = new System.Drawing.Point(0, 427);
this.statusStrip1.Name = "statusStrip1";
- this.statusStrip1.Size = new System.Drawing.Size(800, 26);
+ this.statusStrip1.Size = new System.Drawing.Size(882, 26);
this.statusStrip1.TabIndex = 0;
this.statusStrip1.Text = "statusStrip1";
//
@@ -79,15 +79,17 @@
this.pictureBoxBoat.Dock = System.Windows.Forms.DockStyle.Fill;
this.pictureBoxBoat.Location = new System.Drawing.Point(0, 0);
this.pictureBoxBoat.Name = "pictureBoxBoat";
- this.pictureBoxBoat.Size = new System.Drawing.Size(800, 424);
+ this.pictureBoxBoat.Size = new System.Drawing.Size(882, 427);
this.pictureBoxBoat.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.pictureBoxBoat.TabIndex = 1;
this.pictureBoxBoat.TabStop = false;
+ this.pictureBoxBoat.SizeChanged += new System.EventHandler(this.PictureBoxBoat_Resize);
+ this.pictureBoxBoat.Resize += new System.EventHandler(this.PictureBoxBoat_Resize);
//
// buttonCreate
//
this.buttonCreate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.buttonCreate.Location = new System.Drawing.Point(12, 382);
+ this.buttonCreate.Location = new System.Drawing.Point(12, 385);
this.buttonCreate.Name = "buttonCreate";
this.buttonCreate.Size = new System.Drawing.Size(94, 29);
this.buttonCreate.TabIndex = 2;
@@ -100,7 +102,7 @@
this.buttonRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonRight.BackgroundImage = global::PIbd_22_Kalyshev_Y_V_MotorBoat_Base.Properties.Resources.right;
this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
- this.buttonRight.Location = new System.Drawing.Point(738, 371);
+ this.buttonRight.Location = new System.Drawing.Point(820, 374);
this.buttonRight.Name = "buttonRight";
this.buttonRight.Size = new System.Drawing.Size(40, 40);
this.buttonRight.TabIndex = 3;
@@ -112,7 +114,7 @@
this.buttonLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonLeft.BackgroundImage = global::PIbd_22_Kalyshev_Y_V_MotorBoat_Base.Properties.Resources.left;
this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
- this.buttonLeft.Location = new System.Drawing.Point(646, 371);
+ this.buttonLeft.Location = new System.Drawing.Point(728, 374);
this.buttonLeft.Name = "buttonLeft";
this.buttonLeft.Size = new System.Drawing.Size(40, 40);
this.buttonLeft.TabIndex = 4;
@@ -124,7 +126,7 @@
this.buttonUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonUp.BackgroundImage = global::PIbd_22_Kalyshev_Y_V_MotorBoat_Base.Properties.Resources.up;
this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
- this.buttonUp.Location = new System.Drawing.Point(692, 325);
+ this.buttonUp.Location = new System.Drawing.Point(774, 328);
this.buttonUp.Name = "buttonUp";
this.buttonUp.Size = new System.Drawing.Size(40, 40);
this.buttonUp.TabIndex = 5;
@@ -136,7 +138,7 @@
this.buttonDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonDown.BackgroundImage = global::PIbd_22_Kalyshev_Y_V_MotorBoat_Base.Properties.Resources.down;
this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
- this.buttonDown.Location = new System.Drawing.Point(692, 371);
+ this.buttonDown.Location = new System.Drawing.Point(774, 374);
this.buttonDown.Name = "buttonDown";
this.buttonDown.Size = new System.Drawing.Size(40, 40);
this.buttonDown.TabIndex = 6;
@@ -147,7 +149,7 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(800, 450);
+ this.ClientSize = new System.Drawing.Size(882, 453);
this.Controls.Add(this.buttonDown);
this.Controls.Add(this.buttonUp);
this.Controls.Add(this.buttonLeft);
diff --git a/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/FormBoat.cs b/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/FormBoat.cs
index bdc587d..11cea2d 100644
--- a/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/FormBoat.cs
+++ b/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/FormBoat.cs
@@ -25,9 +25,9 @@ namespace PIbd_22_Kalyshev_Y_V_MotorBoat_Base.git
///
private void ButtonCreate_Click(object sender, EventArgs e)
{
- Random rnd = new();
+ Random rnd = new();
_boat = new DrawningBoat();
- _boat.Init(rnd.Next(100, 300), rnd.Next(1000, 2000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)));
+ _boat.Init(rnd.Next(5, 30), rnd.Next(30, 100), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)));
_boat.SetPosition(rnd.Next(10, 100), rnd.Next(10, 100), pictureBoxBoat.Width, pictureBoxBoat.Height);
toolStripStatusLabelSpeed.Text = $": {_boat.Boat.Speed}";
toolStripStatusLabelWeight.Text = $": {_boat.Boat.Weight}";
@@ -65,7 +65,7 @@ namespace PIbd_22_Kalyshev_Y_V_MotorBoat_Base.git
///
///
///
- private void PictureBoxCar_Resize(object sender, EventArgs e)
+ private void PictureBoxBoat_Resize(object sender, EventArgs e)
{
_boat?.ChangeBorders(pictureBoxBoat.Width, pictureBoxBoat.Height);
Draw();
diff --git a/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/Resources/down.png b/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/Resources/down.png
deleted file mode 100644
index 680d3a3..0000000
Binary files a/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/Resources/down.png and /dev/null differ
diff --git a/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/Resources/left.png b/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/Resources/left.png
deleted file mode 100644
index 1fa7bf1..0000000
Binary files a/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/Resources/left.png and /dev/null differ
diff --git a/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/Resources/right.png b/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/Resources/right.png
deleted file mode 100644
index cd98839..0000000
Binary files a/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/Resources/right.png and /dev/null differ
diff --git a/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/Resources/up.bmp b/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/Resources/up.bmp
deleted file mode 100644
index 55516c7..0000000
Binary files a/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/Resources/up.bmp and /dev/null differ
diff --git a/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/Resources/up.png b/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/Resources/up.png
deleted file mode 100644
index 20e0b15..0000000
Binary files a/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/Resources/up.png and /dev/null differ