From f8520664ccd324320e7e52d3b5136ea1e16f6e8c Mon Sep 17 00:00:00 2001 From: AnnZhimol Date: Wed, 5 Oct 2022 10:27:49 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A2=D0=BE=D1=87=D0=BD=D0=BE=20=D0=B8=D1=82?= =?UTF-8?q?=D0=BE=D0=B3=D0=BE=D0=B2=D1=8B=D0=B9=20=D0=B2=D0=B0=D1=80=D0=B8?= =?UTF-8?q?=D0=B0=D0=BD=D1=82=203=20=D0=BB=D0=B0=D0=B1=D0=BE=D1=80=D0=B0?= =?UTF-8?q?=D1=82=D0=BE=D1=80=D0=BD=D0=BE=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Warship/Warship/FormWarship.cs | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/Warship/Warship/FormWarship.cs b/Warship/Warship/FormWarship.cs index 430a9b6..07d6253 100644 --- a/Warship/Warship/FormWarship.cs +++ b/Warship/Warship/FormWarship.cs @@ -29,7 +29,13 @@ namespace Warship private void ButtonCreate_Click(object sender, EventArgs e) { Random rnd = new(); - _warship = new DrawingWarship(rnd.Next(10, 60), rnd.Next(20000, 25000), 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; + } + _warship = new DrawingWarship(rnd.Next(10, 60), rnd.Next(20000, 25000),color); SetData(); Draw(); } @@ -63,7 +69,19 @@ namespace Warship private void ButtonCreateModif_Click(object sender, EventArgs e) { Random rnd = new(); - _warship = new DrawingAdvancedWarship(rnd.Next(10, 60), rnd.Next(20000, 25000), 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)), Convert.ToBoolean(rnd.Next(0, 2))); + Color color1 = Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)); + ColorDialog dialog1 = new(); + if (dialog1.ShowDialog() == DialogResult.OK) + { + color1 = dialog1.Color; + } + Color color2 = Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)); + ColorDialog dialog2 = new(); + if (dialog2.ShowDialog() == DialogResult.OK) + { + color2 = dialog2.Color; + } + _warship = new DrawingAdvancedWarship(rnd.Next(10, 60), rnd.Next(20000, 25000), color1,color2, Convert.ToBoolean(rnd.Next(0,2)), Convert.ToBoolean(rnd.Next(0, 2)), Convert.ToBoolean(rnd.Next(0, 2))); SetData(); Draw(); }