Исправление

This commit is contained in:
the 2022-10-25 09:28:25 +04:00
parent f965d572bd
commit 8cb74ade23

View File

@ -37,7 +37,13 @@ namespace Ship
private void buttonCreate_Click(object sender, EventArgs e)
{
Random rnd = new();
_ship = new DrawingShip(rnd.Next(100, 300), rnd.Next(1000, 2000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)));
Color color = Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256));
ColorDialog dialog = new();
if (dialog.ShowDialog() == DialogResult.OK)
{
color = dialog.Color;
}
_ship = new DrawingShip(rnd.Next(100, 300), rnd.Next(1000, 2000), color);
_ship.SetPosition(rnd.Next(10, 100), pictureBoxShip.Height - rnd.Next(50, 100),
pictureBoxShip.Width, pictureBoxShip.Height);
SetData();
@ -88,10 +94,18 @@ namespace Ship
private void buttonCreateModif_Click(object sender, EventArgs e)
{
Random rnd = new();
_ship = new DrawingMotorShip(rnd.Next(100, 300), rnd.Next(1000, 2000),
Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)),
Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)),
Convert.ToBoolean(rnd.Next(0, 2)), Convert.ToBoolean(rnd.Next(0, 2)));
Color colorMain = Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256));
Color colorAdd = Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256));
ColorDialog dialog = new();
if (dialog.ShowDialog() == DialogResult.OK)
{
colorMain = dialog.Color;
}
if (dialog.ShowDialog() == DialogResult.OK)
{
colorAdd = dialog.Color;
}
_ship = new DrawingMotorShip(rnd.Next(100, 300), rnd.Next(1000, 2000), colorMain, colorAdd, Convert.ToBoolean(rnd.Next(0, 2)), Convert.ToBoolean(rnd.Next(0, 2)));
_ship.SetPosition(rnd.Next(50, 100), pictureBoxShip.Height - rnd.Next(80, 100), pictureBoxShip.Width, pictureBoxShip.Height);
SetData();
Draw();