From 6316a59bddd81054af918bbbd72ab15cc535bfd9 Mon Sep 17 00:00:00 2001 From: Evgehil Date: Fri, 5 Apr 2024 10:56:56 +0400 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=BD=D0=B0=20=D0=B2=D1=81=D1=82=D1=80=D0=BE?= =?UTF-8?q?=D0=B5=D0=BD=D0=BD=D1=8B=D0=B9=20=D0=B4=D0=B5=D0=BB=D0=B5=D0=B3?= =?UTF-8?q?=D0=B0=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Project_airbus/FormAirplanConfig.cs | 35 ++++++++++++++++--- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/Project_airbus/Project_airbus/FormAirplanConfig.cs b/Project_airbus/Project_airbus/FormAirplanConfig.cs index 75843d9..9e80d4e 100644 --- a/Project_airbus/Project_airbus/FormAirplanConfig.cs +++ b/Project_airbus/Project_airbus/FormAirplanConfig.cs @@ -3,17 +3,20 @@ using Project_airbus.Entities; namespace Project_airbus; +/// +/// Форма конфигурации объекта +/// public partial class FormAirplanConfig : Form { /// /// Объект - прорисовка самолёта /// - private DrawingAirplan? _airplan = null; + private DrawingAirplan? _airplan; /// /// Событие для передачи объекта /// - private event AirplanDelegate? AirplanDelegate; + private event Action _airplanDelegate; /// /// Конструктор @@ -37,9 +40,9 @@ public partial class FormAirplanConfig : Form /// Привязка внешнего метода к событию /// /// - public void AddEvent(AirplanDelegate airplanDelegate) + public void AddEvent(Action airplanDelegate) { - AirplanDelegate += airplanDelegate; + _airplanDelegate += airplanDelegate; } /// @@ -106,6 +109,11 @@ public partial class FormAirplanConfig : Form (sender as Control)?.DoDragDrop((sender as Control)?.BackColor, DragDropEffects.Move | DragDropEffects.Copy); } + /// + /// Передача основного цвета + /// + /// + /// private void labelBodyColor_DragEnter(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(typeof(Color))) @@ -117,6 +125,12 @@ public partial class FormAirplanConfig : Form e.Effect = DragDropEffects.None; } } + + /// + /// Прорисовка с основным цветом + /// + /// + /// private void labelBodyColor_DragDrop(object sender, DragEventArgs e) { if (_airplan != null) @@ -125,6 +139,12 @@ public partial class FormAirplanConfig : Form DrawObject(); } } + + /// + /// Передача дополнительного цвета + /// + /// + /// private void labelAdditionalColor_DragEnter(object sender, DragEventArgs e) { if (_airplan is DrawingAirbus) @@ -140,6 +160,11 @@ public partial class FormAirplanConfig : Form } } + /// + /// Прорисовка с дополнительным цветом + /// + /// + /// private void labelAdditionalColor_DragDrop(object sender, DragEventArgs e) { if (_airplan?.EntityAirplan is EntityAirbus _airbus) @@ -158,7 +183,7 @@ public partial class FormAirplanConfig : Form { if (_airplan != null) { - AirplanDelegate?.Invoke(_airplan); + _airplanDelegate?.Invoke(_airplan); Close(); } }