PIBD-13_Marinenkova_V.A._LabWork05_Base #5

Closed
marva wants to merge 3 commits from LabWork05 into LabWork04
3 changed files with 34 additions and 39 deletions
Showing only changes of commit ce51be30a4 - Show all commits

View File

@ -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);
}
}
}
}

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)
{
}
}