готова laba2

This commit is contained in:
Extrimal 2023-10-18 11:38:04 +03:00
parent 7603d99eb9
commit 570494812c
3 changed files with 18 additions and 13 deletions

View File

@ -102,7 +102,7 @@
// ButtonCreateAircraftCarrier
//
ButtonCreateAircraftCarrier.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
ButtonCreateAircraftCarrier.Location = new Point(26, 381);
ButtonCreateAircraftCarrier.Location = new Point(234, 393);
ButtonCreateAircraftCarrier.Name = "ButtonCreateAircraftCarrier";
ButtonCreateAircraftCarrier.Size = new Size(204, 39);
ButtonCreateAircraftCarrier.TabIndex = 6;
@ -113,7 +113,7 @@
// ButtonCreateAircraft
//
ButtonCreateAircraft.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
ButtonCreateAircraft.Location = new Point(246, 381);
ButtonCreateAircraft.Location = new Point(12, 393);
ButtonCreateAircraft.Name = "ButtonCreateAircraft";
ButtonCreateAircraft.Size = new Size(204, 39);
ButtonCreateAircraft.TabIndex = 7;

View File

@ -1,5 +1,6 @@
using AircraftCarrier.DrawningObjects;
using AircraftCarrier.MovementStrategy;
using System;
namespace AircraftCarrier
{
@ -50,23 +51,26 @@ namespace AircraftCarrier
private void ButtonCreateAircraft_Click(object sender, EventArgs e)
{
Random random = new Random();
_drawingAircraft = new DrawningAircraftCarrier(random.Next(100, 300), random.Next(1000, 3000),
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)),
Random random = new();
_drawingAircraft = new DrawningAircraft(random.Next(100, 300),
random.Next(1000, 3000),
Color.FromArgb(random.Next(0, 256), random.Next(0, 256),
random.Next(0, 256)),
pictureBox.Width, pictureBox.Height);
_drawingAircraft.SetPosition(random.Next(10, 100), random.Next(10, 100));
_drawingAircraft.SetPosition(random.Next(10, 100), random.Next(10,
100));
Draw();
}
private void ButtonCreateAircraftCarrier_Click(object sender, EventArgs e)
{
Random rnd = new Random();
_drawingAircraft = new DrawningAircraft(rnd.Next(100, 300), rnd.Next(1000, 3000),
Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)),
pictureBox.Width, pictureBox.Height);
_drawingAircraft.SetPosition(rnd.Next(10, 100), rnd.Next(10, 100));
Random random = new();
_drawingAircraft = new DrawningAircraftCarrier(random.Next(100, 300), random.Next(1000, 3000),
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
Convert.ToBoolean(random.Next(0, 2)),
Convert.ToBoolean(random.Next(0, 2)), pictureBox.Width, pictureBox.Height);
_drawingAircraft.SetPosition(random.Next(10, 100), random.Next(10, 100));
Draw();
}

View File

@ -18,5 +18,6 @@ namespace AircraftCarrier.MovementStrategy
/// Изменение направления пермещения объекта
/// <param name="direction">Направление</param>
void MoveObject(Direction direction);
}
}