diff --git a/ProjectLiner/ProjectLiner/FormLinerConfig.Designer.cs b/ProjectLiner/ProjectLiner/FormLinerConfig.Designer.cs index 53664a2..4a3d91f 100644 --- a/ProjectLiner/ProjectLiner/FormLinerConfig.Designer.cs +++ b/ProjectLiner/ProjectLiner/FormLinerConfig.Designer.cs @@ -89,6 +89,7 @@ // // labelBodyColor // + labelBodyColor.AllowDrop = true; labelBodyColor.BorderStyle = BorderStyle.FixedSingle; labelBodyColor.Font = new Font("Segoe UI", 9.818182F, FontStyle.Regular, GraphicsUnit.Point); labelBodyColor.Location = new Point(20, 14); @@ -102,6 +103,7 @@ // // labelAdditionslColor // + labelAdditionslColor.AllowDrop = true; labelAdditionslColor.BorderStyle = BorderStyle.FixedSingle; labelAdditionslColor.Location = new Point(146, 14); labelAdditionslColor.Name = "labelAdditionslColor"; diff --git a/ProjectLiner/ProjectLiner/FormLinerConfig.cs b/ProjectLiner/ProjectLiner/FormLinerConfig.cs index 4e20992..c09b8b8 100644 --- a/ProjectLiner/ProjectLiner/FormLinerConfig.cs +++ b/ProjectLiner/ProjectLiner/FormLinerConfig.cs @@ -1,6 +1,7 @@  using ProjectLiner.Drawnings; using ProjectLiner.Entities; +using static System.Windows.Forms.VisualStyles.VisualStyleElement.TrackBar; namespace ProjectLiner; @@ -120,35 +121,69 @@ public partial class FormLinerConfig : Form } } - private void labelBodyColor_DragDrop(object sender, DragEventArgs e) - { - if (_commonLiner == null) - return; - _commonLiner.EntityCommonLiner?.SetBodyColor((Color)e.Data.GetData(typeof(Color))); - DrawObject(); - } + /// + /// Передача основного цвета + /// + /// + /// private void labelBodyColor_DragEnter(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(typeof(Color))) + { e.Effect = DragDropEffects.Copy; + } else + { e.Effect = DragDropEffects.None; + } } + /// + /// Прорисовка основным цветом + /// + /// + /// + private void labelBodyColor_DragDrop(object sender, DragEventArgs e) + { + if (_commonLiner != null) + { + _commonLiner.EntityCommonLiner?.SetBodyColor((Color)e.Data.GetData(typeof(Color))); + DrawObject(); + } + } + + /// + /// Прорисовка дополнительным цветом + /// + /// + /// private void labelAdditionalColor_DragDrop(object sender, DragEventArgs e) { if (_commonLiner?.EntityCommonLiner is EntityLiner _liner) - _liner?.SetAdditionalColor((Color)e.Data.GetData(typeof(Color))); + { + _liner.SetAdditionalColor((Color)e.Data.GetData(typeof(Color))); + } DrawObject(); } + /// + /// Передача дополнительного цвета + /// + /// + /// private void labelAdditionalColor_DragEnter(object sender, DragEventArgs e) { - if (e.Data.GetDataPresent(typeof(Color))) - e.Effect = DragDropEffects.Copy; - else - e.Effect = DragDropEffects.None; + if (_commonLiner is DrawningLiner) + { + if (e.Data.GetDataPresent(typeof(Color))) + { + e.Effect = DragDropEffects.Copy; + } + else + { + e.Effect = DragDropEffects.None; + } + } } - }