Лабораторная работа №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);
// отсек
if (accordionBus.Compartment)
{
g.FillRectangle(additionalBrush, _startPosX.Value + 60, _startPosY.Value, 50, 30);
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);
}
}
}
}

View File

@ -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;
//

View File

@ -17,9 +17,9 @@ public partial class FormBusConfig : Form
/// <summary>
/// Объект прорисовки класса
/// </summary>
private DrawningBus? _bus;
private DrawningBus? _bus = null;
private event BusDelegate? _busDelegate;
private event Action<DrawningAccordionBus>? BusDelegate;
/// <summary>
/// Конструктор
@ -40,9 +40,9 @@ public partial class FormBusConfig : Form
buttonCancel.Click += (sender, e) => Close();
}
public void AddEvent(BusDelegate busDelegate)
public void AddEvent(Action<DrawningAccordionBus> busDelegate)
{
_busDelegate += busDelegate;
BusDelegate += busDelegate;
}
// <summary>
@ -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)
{
}
}