Добавление Color Dialog

This commit is contained in:
ityurner02@mail.ru 2022-10-08 17:03:47 +04:00
parent 2e53a104b7
commit 936764d0b0

View File

@ -47,8 +47,13 @@ namespace AntiAircraftGun
private void ButtonCreate_Click(object sender, EventArgs e) private void ButtonCreate_Click(object sender, EventArgs e)
{ {
Random rnd = new(); Random rnd = new();
_antiAircrafGun = new DrawingAntiAircraftGun(rnd.Next(100, 300), rnd.Next(1000, 2000), Color color = 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();
if (dialog.ShowDialog() == DialogResult.OK)
{
color = dialog.Color;
}
_antiAircrafGun = new DrawingAntiAircraftGun(rnd.Next(100, 300), rnd.Next(1000, 2000), color);
SetData(); SetData();
Draw(); Draw();
} }
@ -96,9 +101,19 @@ namespace AntiAircraftGun
private void ButtonCreareModif_Click(object sender, EventArgs e) private void ButtonCreareModif_Click(object sender, EventArgs e)
{ {
Random rnd = new(); Random rnd = new();
_antiAircrafGun = new DrawingUpdateAntiAircraftGun(rnd.Next(100, 300), rnd.Next(1000, 2000), Color color = 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();
Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)), if (dialog.ShowDialog() == DialogResult.OK)
{
color = dialog.Color;
}
Color dopColor = Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256));
ColorDialog dialogDop = new();
if (dialogDop.ShowDialog() == DialogResult.OK)
{
dopColor = dialogDop.Color;
}
_antiAircrafGun = new DrawingUpdateAntiAircraftGun(rnd.Next(100, 300), rnd.Next(1000, 2000), color, dopColor,
Convert.ToBoolean(rnd.Next(0, 2)), Convert.ToBoolean(rnd.Next(0, 2))); Convert.ToBoolean(rnd.Next(0, 2)), Convert.ToBoolean(rnd.Next(0, 2)));
SetData(); SetData();
Draw(); Draw();