From 63ec815e621bc5bde53d74e2b4b74c909cf06fbc Mon Sep 17 00:00:00 2001 From: artur-kalimullin <144933634+artur-kalimullin@users.noreply.github.com> Date: Mon, 8 Apr 2024 23:45:41 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9B=D0=B0=D0=B1=D0=BE=D1=80=D0=B0=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=BD=D0=B0=D1=8F=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=B0=20=E2=84=965=20(=D0=BA=D0=BE=D0=BD=D0=B5=D1=86)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FormAirCraftConfig.Designer.cs | 8 ++++---- .../ProjectAirFighter/FormAirCraftConfig.cs | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/ProjectAirFighter/ProjectAirFighter/FormAirCraftConfig.Designer.cs b/ProjectAirFighter/ProjectAirFighter/FormAirCraftConfig.Designer.cs index ff885cb..5590d17 100644 --- a/ProjectAirFighter/ProjectAirFighter/FormAirCraftConfig.Designer.cs +++ b/ProjectAirFighter/ProjectAirFighter/FormAirCraftConfig.Designer.cs @@ -298,8 +298,8 @@ labelAdditionalColor.TabIndex = 10; labelAdditionalColor.Text = "Доп. цвет"; labelAdditionalColor.TextAlign = ContentAlignment.MiddleCenter; - labelAdditionalColor.DragDrop += labelAdditionalColor_DragDrop; - labelAdditionalColor.DragEnter += labelAdditionalColor_DragEnter; + labelAdditionalColor.DragDrop += LabelAdditionalColor_DragDrop; + labelAdditionalColor.DragEnter += LabelAdditionalColor_DragEnter; // // labelBodyColor // @@ -311,8 +311,8 @@ labelBodyColor.TabIndex = 9; labelBodyColor.Text = "Цвет"; labelBodyColor.TextAlign = ContentAlignment.MiddleCenter; - labelBodyColor.DragDrop += labelBodyColor_DragDrop; - labelBodyColor.DragEnter += labelBodyColor_DragEnter; + labelBodyColor.DragDrop += LabelBodyColor_DragDrop; + labelBodyColor.DragEnter += LabelBodyColor_DragEnter; // // FormAirCraftConfig // diff --git a/ProjectAirFighter/ProjectAirFighter/FormAirCraftConfig.cs b/ProjectAirFighter/ProjectAirFighter/FormAirCraftConfig.cs index 76486fa..89b8aac 100644 --- a/ProjectAirFighter/ProjectAirFighter/FormAirCraftConfig.cs +++ b/ProjectAirFighter/ProjectAirFighter/FormAirCraftConfig.cs @@ -110,26 +110,26 @@ public partial class FormAirCraftConfig : Form { (sender as Control)?.DoDragDrop((sender as Control)?.BackColor!, DragDropEffects.Move | DragDropEffects.Copy); } - private void labelBodyColor_DragDrop(object sender, DragEventArgs e) + private void LabelBodyColor_DragDrop(object sender, DragEventArgs e) { if (_aircraft == null) return; _aircraft.EntityAirCraft?.SetBodyColor((Color)e.Data.GetData(typeof(Color))); DrawObject(); } - private void labelBodyColor_DragEnter(object sender, DragEventArgs e) + private void LabelBodyColor_DragEnter(object sender, DragEventArgs e) { - if (e.Data.GetDataPresent(typeof(Color))) e.Effect = DragDropEffects.Copy; + if (_aircraft != null && e.Data.GetDataPresent(typeof(Color))) e.Effect = DragDropEffects.Copy; else e.Effect = DragDropEffects.None; } - private void labelAdditionalColor_DragDrop(object sender, DragEventArgs e) + private void LabelAdditionalColor_DragDrop(object sender, DragEventArgs e) { - if (_aircraft?.EntityAirCraft is EntityAirFighter _airfighter) - _airfighter?.SetAdditionalColor((Color)e.Data.GetData(typeof(Color))); + if (_aircraft != null && _aircraft.EntityAirCraft is EntityAirFighter _airfighter) + _airfighter.SetAdditionalColor((Color)e.Data.GetData(typeof(Color))); DrawObject(); } - private void labelAdditionalColor_DragEnter(object sender, DragEventArgs e) + private void LabelAdditionalColor_DragEnter(object sender, DragEventArgs e) { - if (e.Data.GetDataPresent(typeof(Color))) e.Effect = DragDropEffects.Copy; + if (_aircraft != null && e.Data.GetDataPresent(typeof(Color)) && _aircraft.EntityAirCraft is EntityAirFighter) e.Effect = DragDropEffects.Copy; else e.Effect = DragDropEffects.None; }