Исправление
This commit is contained in:
parent
45aa67a6bc
commit
c265d94f01
@ -37,7 +37,13 @@ namespace Ship
|
|||||||
private void buttonCreate_Click(object sender, EventArgs e)
|
private void buttonCreate_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Random rnd = new();
|
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),
|
_ship.SetPosition(rnd.Next(10, 100), pictureBoxShip.Height - rnd.Next(50, 100),
|
||||||
pictureBoxShip.Width, pictureBoxShip.Height);
|
pictureBoxShip.Width, pictureBoxShip.Height);
|
||||||
SetData();
|
SetData();
|
||||||
@ -88,10 +94,18 @@ namespace Ship
|
|||||||
private void buttonCreateModif_Click(object sender, EventArgs e)
|
private void buttonCreateModif_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Random rnd = new();
|
Random rnd = new();
|
||||||
_ship = new DrawingMotorShip(rnd.Next(100, 300), rnd.Next(1000, 2000),
|
Color colorMain = 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)),
|
Color colorAdd = 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)),
|
ColorDialog dialog = new();
|
||||||
Convert.ToBoolean(rnd.Next(0, 2)), Convert.ToBoolean(rnd.Next(0, 2)));
|
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);
|
_ship.SetPosition(rnd.Next(50, 100), pictureBoxShip.Height - rnd.Next(80, 100), pictureBoxShip.Width, pictureBoxShip.Height);
|
||||||
SetData();
|
SetData();
|
||||||
Draw();
|
Draw();
|
||||||
|
Loading…
Reference in New Issue
Block a user