Лабораторная работа №5

This commit is contained in:
mar-va 2024-04-17 16:48:53 +04:00
parent 874486dd20
commit ce51be30a4
3 changed files with 34 additions and 39 deletions

View File

@ -28,6 +28,8 @@ public class DrawningAccordionBus : DrawningBus
Brush brushBlue = new SolidBrush(Color.Blue); Brush brushBlue = new SolidBrush(Color.Blue);
// отсек // отсек
if (accordionBus.Compartment)
{
g.FillRectangle(additionalBrush, _startPosX.Value + 60, _startPosY.Value, 50, 30); g.FillRectangle(additionalBrush, _startPosX.Value + 60, _startPosY.Value, 50, 30);
g.FillRectangle(additionalBrush, _startPosX.Value + 50, _startPosY.Value + 5, 10, 20); g.FillRectangle(additionalBrush, _startPosX.Value + 50, _startPosY.Value + 5, 10, 20);
@ -59,4 +61,5 @@ public class DrawningAccordionBus : DrawningBus
g.DrawEllipse(pen, _startPosX.Value + 90, _startPosY.Value + 5, 5, 10); g.DrawEllipse(pen, _startPosX.Value + 90, _startPosY.Value + 5, 5, 10);
} }
} }
}
} }

View File

@ -327,7 +327,6 @@
labelBodyColor.TabIndex = 2; labelBodyColor.TabIndex = 2;
labelBodyColor.Text = "Цвет"; labelBodyColor.Text = "Цвет";
labelBodyColor.TextAlign = ContentAlignment.MiddleCenter; labelBodyColor.TextAlign = ContentAlignment.MiddleCenter;
labelBodyColor.Click += labelBodyColor_Click;
labelBodyColor.DragDrop += labelBodyColor_DragDrop; labelBodyColor.DragDrop += labelBodyColor_DragDrop;
labelBodyColor.DragEnter += labelBodyColor_DragEnter; labelBodyColor.DragEnter += labelBodyColor_DragEnter;
// //

View File

@ -17,9 +17,9 @@ public partial class FormBusConfig : Form
/// <summary> /// <summary>
/// Объект прорисовки класса /// Объект прорисовки класса
/// </summary> /// </summary>
private DrawningBus? _bus; private DrawningBus? _bus = null;
private event BusDelegate? _busDelegate; private event Action<DrawningAccordionBus>? BusDelegate;
/// <summary> /// <summary>
/// Конструктор /// Конструктор
@ -40,9 +40,9 @@ public partial class FormBusConfig : Form
buttonCancel.Click += (sender, e) => Close(); buttonCancel.Click += (sender, e) => Close();
} }
public void AddEvent(BusDelegate busDelegate) public void AddEvent(Action<DrawningAccordionBus> busDelegate)
{ {
_busDelegate += busDelegate; BusDelegate += busDelegate;
} }
// <summary> // <summary>
@ -92,8 +92,7 @@ public partial class FormBusConfig : Form
(double)numericUpDownWeight.Value, Color.White); (double)numericUpDownWeight.Value, Color.White);
break; break;
case "labelModifiedObject": case "labelModifiedObject":
_bus = new _bus = new DrawningAccordionBus((int)numericUpDownSpeed.Value, (double)numericUpDownWeight.Value,
DrawningAccordionBus((int)numericUpDownSpeed.Value, (double)numericUpDownWeight.Value,
Color.White, Color.White,
Color.Black, checkBoxCompartment.Checked, Color.Black, checkBoxCompartment.Checked,
checkBoxEntrance.Checked, checkBoxWindows.Checked); checkBoxEntrance.Checked, checkBoxWindows.Checked);
@ -113,7 +112,7 @@ public partial class FormBusConfig : Form
{ {
if (_bus != null) if (_bus != null)
{ {
_busDelegate?.Invoke(_bus); BusDelegate?.Invoke((DrawningAccordionBus)_bus);
Close(); Close();
} }
} }
@ -161,11 +160,5 @@ public partial class FormBusConfig : Form
_accordionBus.SetAdditionalColor((Color)e.Data.GetData(typeof(Color))); _accordionBus.SetAdditionalColor((Color)e.Data.GetData(typeof(Color)));
} }
DrawObject(); DrawObject();
}
private void labelBodyColor_Click(object sender, EventArgs e)
{
} }
} }