From ce51be30a40d6ddf6cba30264d3d832061adb5de Mon Sep 17 00:00:00 2001 From: mar-va Date: Wed, 17 Apr 2024 16:48:53 +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?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Drawnings/DrawningAccordionBus.cs | 53 ++++++++++--------- .../FormBusConfig.Designer.cs | 1 - .../ProjectAccordionBus/FormBusConfig.cs | 19 +++---- 3 files changed, 34 insertions(+), 39 deletions(-) diff --git a/ProjectAccordionBus/ProjectAccordionBus/Drawnings/DrawningAccordionBus.cs b/ProjectAccordionBus/ProjectAccordionBus/Drawnings/DrawningAccordionBus.cs index cc0df31..95a514a 100644 --- a/ProjectAccordionBus/ProjectAccordionBus/Drawnings/DrawningAccordionBus.cs +++ b/ProjectAccordionBus/ProjectAccordionBus/Drawnings/DrawningAccordionBus.cs @@ -28,35 +28,38 @@ public class DrawningAccordionBus : DrawningBus Brush brushBlue = new SolidBrush(Color.Blue); // отсек - g.FillRectangle(additionalBrush, _startPosX.Value + 60, _startPosY.Value, 50, 30); - g.FillRectangle(additionalBrush, _startPosX.Value + 50, _startPosY.Value + 5, 10, 20); - - g.DrawRectangle(pen, _startPosX.Value + 60, _startPosY.Value, 50, 30); - g.DrawRectangle(pen, _startPosX.Value + 50, _startPosY.Value + 5, 10, 20); - - // колеса - g.FillEllipse(additionalBrush, _startPosX.Value + 65, _startPosY.Value + 25, 10, 10); - g.FillEllipse(additionalBrush, _startPosX.Value + 95, _startPosY.Value + 25, 10, 10); - - g.DrawEllipse(pen, _startPosX.Value + 65, _startPosY.Value + 25, 10, 10); - g.DrawEllipse(pen, _startPosX.Value + 95, _startPosY.Value + 25, 10, 10); - - if (accordionBus.Entrance) + if (accordionBus.Compartment) { - g.FillRectangle(additionalBrush, _startPosX.Value + 78, _startPosY.Value + 10, 10, 20); + g.FillRectangle(additionalBrush, _startPosX.Value + 60, _startPosY.Value, 50, 30); + g.FillRectangle(additionalBrush, _startPosX.Value + 50, _startPosY.Value + 5, 10, 20); - g.DrawRectangle(pen, _startPosX.Value + 78, _startPosY.Value + 10, 10, 20); - } + g.DrawRectangle(pen, _startPosX.Value + 60, _startPosY.Value, 50, 30); + g.DrawRectangle(pen, _startPosX.Value + 50, _startPosY.Value + 5, 10, 20); - if (accordionBus.Windows) - { - g.FillEllipse(brushBlue, _startPosX.Value + 65, _startPosY.Value + 5, 5, 10); - g.FillEllipse(brushBlue, _startPosX.Value + 100, _startPosY.Value + 5, 5, 10); - g.FillEllipse(brushBlue, _startPosX.Value + 90, _startPosY.Value + 5, 5, 10); + // колеса + g.FillEllipse(additionalBrush, _startPosX.Value + 65, _startPosY.Value + 25, 10, 10); + g.FillEllipse(additionalBrush, _startPosX.Value + 95, _startPosY.Value + 25, 10, 10); - g.DrawEllipse(pen, _startPosX.Value + 65, _startPosY.Value + 5, 5, 10); - g.DrawEllipse(pen, _startPosX.Value + 100, _startPosY.Value + 5, 5, 10); - g.DrawEllipse(pen, _startPosX.Value + 90, _startPosY.Value + 5, 5, 10); + g.DrawEllipse(pen, _startPosX.Value + 65, _startPosY.Value + 25, 10, 10); + g.DrawEllipse(pen, _startPosX.Value + 95, _startPosY.Value + 25, 10, 10); + + if (accordionBus.Entrance) + { + g.FillRectangle(additionalBrush, _startPosX.Value + 78, _startPosY.Value + 10, 10, 20); + + g.DrawRectangle(pen, _startPosX.Value + 78, _startPosY.Value + 10, 10, 20); + } + + if (accordionBus.Windows) + { + g.FillEllipse(brushBlue, _startPosX.Value + 65, _startPosY.Value + 5, 5, 10); + g.FillEllipse(brushBlue, _startPosX.Value + 100, _startPosY.Value + 5, 5, 10); + g.FillEllipse(brushBlue, _startPosX.Value + 90, _startPosY.Value + 5, 5, 10); + + g.DrawEllipse(pen, _startPosX.Value + 65, _startPosY.Value + 5, 5, 10); + g.DrawEllipse(pen, _startPosX.Value + 100, _startPosY.Value + 5, 5, 10); + g.DrawEllipse(pen, _startPosX.Value + 90, _startPosY.Value + 5, 5, 10); + } } } } \ No newline at end of file diff --git a/ProjectAccordionBus/ProjectAccordionBus/FormBusConfig.Designer.cs b/ProjectAccordionBus/ProjectAccordionBus/FormBusConfig.Designer.cs index 263bcfd..b53fd1a 100644 --- a/ProjectAccordionBus/ProjectAccordionBus/FormBusConfig.Designer.cs +++ b/ProjectAccordionBus/ProjectAccordionBus/FormBusConfig.Designer.cs @@ -327,7 +327,6 @@ labelBodyColor.TabIndex = 2; labelBodyColor.Text = "Цвет"; labelBodyColor.TextAlign = ContentAlignment.MiddleCenter; - labelBodyColor.Click += labelBodyColor_Click; labelBodyColor.DragDrop += labelBodyColor_DragDrop; labelBodyColor.DragEnter += labelBodyColor_DragEnter; // diff --git a/ProjectAccordionBus/ProjectAccordionBus/FormBusConfig.cs b/ProjectAccordionBus/ProjectAccordionBus/FormBusConfig.cs index f7dab15..a6ee16e 100644 --- a/ProjectAccordionBus/ProjectAccordionBus/FormBusConfig.cs +++ b/ProjectAccordionBus/ProjectAccordionBus/FormBusConfig.cs @@ -17,9 +17,9 @@ public partial class FormBusConfig : Form /// /// Объект прорисовки класса /// - private DrawningBus? _bus; + private DrawningBus? _bus = null; - private event BusDelegate? _busDelegate; + private event Action? BusDelegate; /// /// Конструктор @@ -40,9 +40,9 @@ public partial class FormBusConfig : Form buttonCancel.Click += (sender, e) => Close(); } - public void AddEvent(BusDelegate busDelegate) + public void AddEvent(Action busDelegate) { - _busDelegate += busDelegate; + BusDelegate += busDelegate; } // @@ -92,8 +92,7 @@ public partial class FormBusConfig : Form (double)numericUpDownWeight.Value, Color.White); break; case "labelModifiedObject": - _bus = new - DrawningAccordionBus((int)numericUpDownSpeed.Value, (double)numericUpDownWeight.Value, + _bus = new DrawningAccordionBus((int)numericUpDownSpeed.Value, (double)numericUpDownWeight.Value, Color.White, Color.Black, checkBoxCompartment.Checked, checkBoxEntrance.Checked, checkBoxWindows.Checked); @@ -113,7 +112,7 @@ public partial class FormBusConfig : Form { if (_bus != null) { - _busDelegate?.Invoke(_bus); + BusDelegate?.Invoke((DrawningAccordionBus)_bus); Close(); } } @@ -161,11 +160,5 @@ public partial class FormBusConfig : Form _accordionBus.SetAdditionalColor((Color)e.Data.GetData(typeof(Color))); } DrawObject(); - - } - - private void labelBodyColor_Click(object sender, EventArgs e) - { - } }