From 0dfabf5f19777183698f9361d644cf452c166565 Mon Sep 17 00:00:00 2001 From: tellsense Date: Sun, 12 Nov 2023 22:25:06 +0400 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ElectricLocomotive/FormLocomotiveConfig.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ElectricLocomotive/ElectricLocomotive/FormLocomotiveConfig.cs b/ElectricLocomotive/ElectricLocomotive/FormLocomotiveConfig.cs index ee2f971..cc162f7 100644 --- a/ElectricLocomotive/ElectricLocomotive/FormLocomotiveConfig.cs +++ b/ElectricLocomotive/ElectricLocomotive/FormLocomotiveConfig.cs @@ -28,8 +28,10 @@ namespace ProjectElectricLocomotive panelColorWhite.MouseDown += PanelColor_MouseDown; panelColorYellow.MouseDown += PanelColor_MouseDown; panelColorBlue.MouseDown += PanelColor_MouseDown; + labelSimpleObject.MouseDown += LabelObject_MouseDown; + labelAdvancedObject.MouseDown += LabelObject_MouseDown; - buttonCancelObject.Click += (sender, e) => Close(); + buttonCancelObject.Click += (s, e) => Close(); } public void AddEvent(LocomotiveDelegate ev) @@ -55,6 +57,7 @@ namespace ProjectElectricLocomotive { (sender as Label)?.DoDragDrop((sender as Label)?.Name, DragDropEffects.Move | DragDropEffects.Copy); } + private void PanelObject_DragEnter(object sender, DragEventArgs e) { if (e.Data?.GetDataPresent(DataFormats.Text) ?? false) @@ -75,7 +78,7 @@ namespace ProjectElectricLocomotive (int)numericUpDownWeight.Value, Color.White, pictureBoxLoco.Width, pictureBoxLoco.Height); break; - case "labelModifiedObject": + case "labelAdvancedObject": _locomotive = new DrawingElectricLocomotive((int)numericUpDownSpeed.Value, (int)numericUpDownWeight.Value, Color.White, Color.Black, checkBoxPantograph.Checked, checkBoxCompartment.Checked, pictureBoxLoco.Width, @@ -84,16 +87,19 @@ namespace ProjectElectricLocomotive } DrawLocomotive(); } + private void buttonAddObject_Click(object sender, EventArgs e) { EventAddLocomotive?.Invoke(_locomotive); Close(); } + private void PanelColor_MouseDown(object sender, MouseEventArgs e) { (sender as Panel)?.DoDragDrop((sender as Panel)?.BackColor, DragDropEffects.Move | DragDropEffects.Copy); } + private void LabelColor_DragDrop(object sender, DragEventArgs e) { ((Label)sender).BackColor = (Color)e.Data.GetData(typeof(Color));