From db909122067065d8e383e274bef5bfdf83de1eda Mon Sep 17 00:00:00 2001 From: Nikita Potapov <47923521+nikita-potapov@users.noreply.github.com> Date: Tue, 15 Nov 2022 11:15:37 +0400 Subject: [PATCH] FormConfig fixed --- Boats/Boats/EntityCatamaran.cs | 4 ++++ Boats/Boats/FormBoatConfig.cs | 6 ++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Boats/Boats/EntityCatamaran.cs b/Boats/Boats/EntityCatamaran.cs index 4ad7d8b..14f907c 100644 --- a/Boats/Boats/EntityCatamaran.cs +++ b/Boats/Boats/EntityCatamaran.cs @@ -37,5 +37,9 @@ namespace Boats Bobbers = bobbers; Sail = sail; } + public void SetDopColor(Color color) + { + DopColor = color; + } } } diff --git a/Boats/Boats/FormBoatConfig.cs b/Boats/Boats/FormBoatConfig.cs index 62e374b..d619df8 100644 --- a/Boats/Boats/FormBoatConfig.cs +++ b/Boats/Boats/FormBoatConfig.cs @@ -147,10 +147,9 @@ namespace Boats /// private void LabelBaseColor_DragDrop(object sender, DragEventArgs e) { - labelBaseColor.BackColor = (Color)e.Data.GetData(typeof(Color).ToString()); if (_boat == null) return; - _boat.Boat.BodyColor = labelBaseColor.BackColor; + _boat.Boat.BodyColor = (Color)e.Data.GetData(typeof(Color).ToString()); DrawBoat(); } /// @@ -176,10 +175,9 @@ namespace Boats /// private void LabelDopColor_DragDrop(object sender, DragEventArgs e) { - labelDopColor.BackColor = (Color)e.Data.GetData(typeof(Color).ToString()); if (_boat == null || _boat is not DrawingCatamaran) return; - (_boat.Boat as EntityCatamaran).DopColor = labelDopColor.BackColor; + (_boat.Boat as EntityCatamaran).SetDopColor((Color)e.Data.GetData(typeof(Color).ToString())); DrawBoat(); } ///