Исправления
This commit is contained in:
parent
c85750c855
commit
ff496f96ed
@ -19,12 +19,12 @@ namespace AccordionBus.Drawnings
|
||||
/// <param name="weight"></param>
|
||||
/// <param name="bodyColor"></param>
|
||||
/// <param name="additionalColor"></param>
|
||||
/// <param name="onePart"></param>
|
||||
/// <param name="hatch"></param>
|
||||
/// <param name="fiveDoors"></param>
|
||||
public DrawningAccordionBus(int speed, double weight, Color bodyColor, Color
|
||||
additionalColor, bool onePart, bool fiveDoors): base(130, 20)
|
||||
additionalColor, bool hatch, bool fiveDoors): base(130, 20)
|
||||
{
|
||||
EntityBus = new EntityAccordionBus(speed, weight, bodyColor, additionalColor, onePart, fiveDoors);
|
||||
EntityBus = new EntityAccordionBus(speed, weight, bodyColor, additionalColor, hatch, fiveDoors);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -41,60 +41,66 @@ namespace AccordionBus.Drawnings
|
||||
|
||||
base.DrawTransport(g);
|
||||
|
||||
if (!accordionBus.OnePart)
|
||||
Pen pen = new(Color.Black);
|
||||
Brush brWhite = new SolidBrush(Color.White);
|
||||
Brush br = new SolidBrush(accordionBus.BodyColor);
|
||||
Brush brBlue = new SolidBrush(Color.LightBlue);
|
||||
Brush additionalBrush = new SolidBrush(accordionBus.AdditionalColor);
|
||||
//корпус
|
||||
g.FillRectangle(br, _startPosX.Value + 70, _startPosY.Value, 60, 15);
|
||||
g.DrawRectangle(pen, _startPosX.Value + 70, _startPosY.Value, 60, 15);
|
||||
|
||||
//колёса
|
||||
g.FillEllipse(brWhite, _startPosX.Value + 75, _startPosY.Value + 10, 10, 10);
|
||||
g.FillEllipse(brWhite, _startPosX.Value + 110, _startPosY.Value + 10, 10, 10);
|
||||
g.DrawEllipse(pen, _startPosX.Value + 110, _startPosY.Value + 10, 10, 10);
|
||||
g.DrawEllipse(pen, _startPosX.Value + 75, _startPosY.Value + 10, 10, 10);
|
||||
|
||||
//стёкла
|
||||
g.FillRectangle(brBlue, _startPosX.Value + 72, _startPosY.Value + 3, 5, 5);
|
||||
g.DrawRectangle(pen, _startPosX.Value + 72, _startPosY.Value + 3, 5, 5);
|
||||
g.FillRectangle(brBlue, _startPosX.Value + 82, _startPosY.Value + 3, 5, 5);
|
||||
g.DrawRectangle(pen, _startPosX.Value + 82, _startPosY.Value + 3, 5, 5);
|
||||
g.FillRectangle(brBlue, _startPosX.Value + 92, _startPosY.Value + 3, 5, 5);
|
||||
g.DrawRectangle(pen, _startPosX.Value + 92, _startPosY.Value + 3, 5, 5);
|
||||
g.FillRectangle(brBlue, _startPosX.Value + 102, _startPosY.Value + 3, 5, 5);
|
||||
g.DrawRectangle(pen, _startPosX.Value + 102, _startPosY.Value + 3, 5, 5);
|
||||
g.FillRectangle(brBlue, _startPosX.Value + 112, _startPosY.Value + 3, 5, 5);
|
||||
g.DrawRectangle(pen, _startPosX.Value + 112, _startPosY.Value + 3, 5, 5);
|
||||
|
||||
//гормошка
|
||||
g.DrawLine(pen, _startPosX.Value + 60, _startPosY.Value, _startPosX.Value + 62, _startPosY.Value + 3);
|
||||
g.DrawLine(pen, _startPosX.Value + 62, _startPosY.Value + 3, _startPosX.Value + 65, _startPosY.Value);
|
||||
g.DrawLine(pen, _startPosX.Value + 65, _startPosY.Value, _startPosX.Value + 67, _startPosY.Value + 3);
|
||||
g.DrawLine(pen, _startPosX.Value + 67, _startPosY.Value + 3, _startPosX.Value + 70, _startPosY.Value);
|
||||
g.DrawLine(pen, _startPosX.Value + 60, _startPosY.Value + 15, _startPosX.Value + 62, _startPosY.Value + 12);
|
||||
g.DrawLine(pen, _startPosX.Value + 62, _startPosY.Value + 12, _startPosX.Value + 65, _startPosY.Value + 15);
|
||||
g.DrawLine(pen, _startPosX.Value + 65, _startPosY.Value + 15, _startPosX.Value + 67, _startPosY.Value + 12);
|
||||
g.DrawLine(pen, _startPosX.Value + 67, _startPosY.Value + 12, _startPosX.Value + 70, _startPosY.Value + 15);
|
||||
g.DrawLine(pen, _startPosX.Value + 62, _startPosY.Value + 3, _startPosX.Value + 62, _startPosY.Value + 12);
|
||||
g.DrawLine(pen, _startPosX.Value + 67, _startPosY.Value + 3, _startPosX.Value + 67, _startPosY.Value + 12);
|
||||
g.DrawLine(pen, _startPosX.Value + 65, _startPosY.Value, _startPosX.Value + 65, _startPosY.Value + 15);
|
||||
|
||||
//двери
|
||||
g.FillRectangle(additionalBrush, _startPosX.Value + 123, _startPosY.Value + 5, 5, 10);
|
||||
g.DrawRectangle(pen, _startPosX.Value + 123, _startPosY.Value + 5, 5, 10);
|
||||
if (accordionBus.FiveDoors)
|
||||
{
|
||||
Pen pen = new(Color.Black);
|
||||
Brush brWhite = new SolidBrush(Color.White);
|
||||
Brush br = new SolidBrush(accordionBus.BodyColor);
|
||||
Brush brBlue = new SolidBrush(Color.LightBlue);
|
||||
Brush additionalBrush = new SolidBrush(accordionBus.AdditionalColor);
|
||||
//корпус
|
||||
g.FillRectangle(br, _startPosX.Value + 70, _startPosY.Value, 60, 15);
|
||||
g.DrawRectangle(pen, _startPosX.Value + 70, _startPosY.Value, 60, 15);
|
||||
g.FillRectangle(additionalBrush, _startPosX.Value + 87, _startPosY.Value + 9, 21, 5);
|
||||
g.DrawRectangle(pen, _startPosX.Value + 87, _startPosY.Value + 9, 21, 5);
|
||||
g.FillRectangle(additionalBrush, _startPosX.Value + 53, _startPosY.Value + 5, 5, 10);
|
||||
g.DrawRectangle(pen, _startPosX.Value + 53, _startPosY.Value + 5, 5, 10);
|
||||
g.FillRectangle(additionalBrush, _startPosX.Value + 27, _startPosY.Value + 9, 11, 5);
|
||||
g.DrawRectangle(pen, _startPosX.Value + 27, _startPosY.Value + 9, 11, 5);
|
||||
}
|
||||
|
||||
//колёса
|
||||
g.FillEllipse(brWhite, _startPosX.Value + 75, _startPosY.Value + 10, 10, 10);
|
||||
g.FillEllipse(brWhite, _startPosX.Value + 110, _startPosY.Value + 10, 10, 10);
|
||||
g.DrawEllipse(pen, _startPosX.Value + 110, _startPosY.Value + 10, 10, 10);
|
||||
g.DrawEllipse(pen, _startPosX.Value + 75, _startPosY.Value + 10, 10, 10);
|
||||
|
||||
//стёкла
|
||||
g.FillRectangle(brBlue, _startPosX.Value + 72, _startPosY.Value + 3, 5, 5);
|
||||
g.DrawRectangle(pen, _startPosX.Value + 72, _startPosY.Value + 3, 5, 5);
|
||||
g.FillRectangle(brBlue, _startPosX.Value + 82, _startPosY.Value + 3, 5, 5);
|
||||
g.DrawRectangle(pen, _startPosX.Value + 82, _startPosY.Value + 3, 5, 5);
|
||||
g.FillRectangle(brBlue, _startPosX.Value + 92, _startPosY.Value + 3, 5, 5);
|
||||
g.DrawRectangle(pen, _startPosX.Value + 92, _startPosY.Value + 3, 5, 5);
|
||||
g.FillRectangle(brBlue, _startPosX.Value + 102, _startPosY.Value + 3, 5, 5);
|
||||
g.DrawRectangle(pen, _startPosX.Value + 102, _startPosY.Value + 3, 5, 5);
|
||||
g.FillRectangle(brBlue, _startPosX.Value + 112, _startPosY.Value + 3, 5, 5);
|
||||
g.DrawRectangle(pen, _startPosX.Value + 112, _startPosY.Value + 3, 5, 5);
|
||||
|
||||
//гормошка
|
||||
g.DrawLine(pen, _startPosX.Value + 60, _startPosY.Value, _startPosX.Value + 62, _startPosY.Value + 3);
|
||||
g.DrawLine(pen, _startPosX.Value + 62, _startPosY.Value + 3, _startPosX.Value + 65, _startPosY.Value);
|
||||
g.DrawLine(pen, _startPosX.Value + 65, _startPosY.Value, _startPosX.Value + 67, _startPosY.Value + 3);
|
||||
g.DrawLine(pen, _startPosX.Value + 67, _startPosY.Value + 3, _startPosX.Value + 70, _startPosY.Value);
|
||||
g.DrawLine(pen, _startPosX.Value + 60, _startPosY.Value + 15, _startPosX.Value + 62, _startPosY.Value + 12);
|
||||
g.DrawLine(pen, _startPosX.Value + 62, _startPosY.Value + 12, _startPosX.Value + 65, _startPosY.Value + 15);
|
||||
g.DrawLine(pen, _startPosX.Value + 65, _startPosY.Value + 15, _startPosX.Value + 67, _startPosY.Value + 12);
|
||||
g.DrawLine(pen, _startPosX.Value + 67, _startPosY.Value + 12, _startPosX.Value + 70, _startPosY.Value + 15);
|
||||
g.DrawLine(pen, _startPosX.Value + 62, _startPosY.Value + 3, _startPosX.Value + 62, _startPosY.Value + 12);
|
||||
g.DrawLine(pen, _startPosX.Value + 67, _startPosY.Value + 3, _startPosX.Value + 67, _startPosY.Value + 12);
|
||||
g.DrawLine(pen, _startPosX.Value + 65, _startPosY.Value, _startPosX.Value + 65, _startPosY.Value + 15);
|
||||
|
||||
//двери
|
||||
g.FillRectangle(additionalBrush, _startPosX.Value + 123, _startPosY.Value + 5, 5, 10);
|
||||
g.DrawRectangle(pen, _startPosX.Value + 123, _startPosY.Value + 5, 5, 10);
|
||||
if (accordionBus.FiveDoors)
|
||||
{
|
||||
g.FillRectangle(additionalBrush, _startPosX.Value + 87, _startPosY.Value + 9, 21, 5);
|
||||
g.DrawRectangle(pen, _startPosX.Value + 87, _startPosY.Value + 9, 21, 5);
|
||||
g.FillRectangle(additionalBrush, _startPosX.Value + 53, _startPosY.Value + 5, 5, 10);
|
||||
g.DrawRectangle(pen, _startPosX.Value + 53, _startPosY.Value + 5, 5, 10);
|
||||
g.FillRectangle(additionalBrush, _startPosX.Value + 27, _startPosY.Value + 9, 11, 5);
|
||||
g.DrawRectangle(pen, _startPosX.Value + 27, _startPosY.Value + 9, 11, 5);
|
||||
}
|
||||
//люки
|
||||
if (accordionBus.Hatch)
|
||||
{
|
||||
g.FillRectangle(additionalBrush, _startPosX.Value + 10, _startPosY.Value - 3, 10, 3);
|
||||
g.FillRectangle(additionalBrush, _startPosX.Value + 90, _startPosY.Value - 3, 10, 3);
|
||||
g.DrawRectangle(pen, _startPosX.Value + 10, _startPosY.Value - 3, 10, 3);
|
||||
g.DrawRectangle(pen, _startPosX.Value + 90, _startPosY.Value - 3, 10, 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ namespace AccordionBus.Entities
|
||||
/// <summary>
|
||||
/// Одна часть
|
||||
/// </summary>
|
||||
public bool OnePart { get; set; }
|
||||
public bool Hatch { get; set; }
|
||||
/// <summary>
|
||||
/// 5 дверей
|
||||
/// </summary>
|
||||
@ -30,13 +30,13 @@ namespace AccordionBus.Entities
|
||||
/// <param name="weight">вес</param>
|
||||
/// <param name="bodyColor">Основной цвет</param>
|
||||
/// <param name="additionalColor">Дополнительный цвет</param>
|
||||
/// <param name="onePart">1 часть</param>
|
||||
/// <param name="hatch">1 часть</param>
|
||||
/// <param name="fiveDoors">5 дверей</param>
|
||||
public EntityAccordionBus(int speed, double weight, Color bodyColor,
|
||||
Color additionalColor, bool onePart, bool fiveDoors) : base(speed, weight, bodyColor)
|
||||
Color additionalColor, bool hatch, bool fiveDoors) : base(speed, weight, bodyColor)
|
||||
{
|
||||
AdditionalColor = additionalColor;
|
||||
OnePart = onePart;
|
||||
Hatch = hatch;
|
||||
FiveDoors = fiveDoors;
|
||||
}
|
||||
|
||||
|
20
AccordionBus/AccordionBus/FormBusConfig.Designer.cs
generated
20
AccordionBus/AccordionBus/FormBusConfig.Designer.cs
generated
@ -39,7 +39,7 @@
|
||||
panelGreen = new Panel();
|
||||
panelRed = new Panel();
|
||||
checkBoxFiveDoors = new CheckBox();
|
||||
checkBoxOnePart = new CheckBox();
|
||||
checkBoxHatch = new CheckBox();
|
||||
numericUpDownWeight = new NumericUpDown();
|
||||
labelWeight = new Label();
|
||||
numericUpDownSpeed = new NumericUpDown();
|
||||
@ -64,7 +64,7 @@
|
||||
//
|
||||
groupBoxConfig.Controls.Add(groupBoxColor);
|
||||
groupBoxConfig.Controls.Add(checkBoxFiveDoors);
|
||||
groupBoxConfig.Controls.Add(checkBoxOnePart);
|
||||
groupBoxConfig.Controls.Add(checkBoxHatch);
|
||||
groupBoxConfig.Controls.Add(numericUpDownWeight);
|
||||
groupBoxConfig.Controls.Add(labelWeight);
|
||||
groupBoxConfig.Controls.Add(numericUpDownSpeed);
|
||||
@ -180,13 +180,13 @@
|
||||
//
|
||||
// checkBoxOnePart
|
||||
//
|
||||
checkBoxOnePart.AutoSize = true;
|
||||
checkBoxOnePart.Location = new Point(24, 118);
|
||||
checkBoxOnePart.Name = "checkBoxOnePart";
|
||||
checkBoxOnePart.Size = new Size(149, 24);
|
||||
checkBoxOnePart.TabIndex = 6;
|
||||
checkBoxOnePart.Text = "Простой автобус";
|
||||
checkBoxOnePart.UseVisualStyleBackColor = true;
|
||||
checkBoxHatch.AutoSize = true;
|
||||
checkBoxHatch.Location = new Point(24, 118);
|
||||
checkBoxHatch.Name = "checkBoxOnePart";
|
||||
checkBoxHatch.Size = new Size(69, 24);
|
||||
checkBoxHatch.TabIndex = 6;
|
||||
checkBoxHatch.Text = "Люки";
|
||||
checkBoxHatch.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// numericUpDownWeight
|
||||
//
|
||||
@ -347,7 +347,7 @@
|
||||
private Label labelWeight;
|
||||
private NumericUpDown numericUpDownSpeed;
|
||||
private NumericUpDown numericUpDownWeight;
|
||||
private CheckBox checkBoxOnePart;
|
||||
private CheckBox checkBoxHatch;
|
||||
private CheckBox checkBoxFiveDoors;
|
||||
private GroupBox groupBoxColor;
|
||||
private Panel panelRed;
|
||||
|
@ -16,7 +16,7 @@ namespace AccordionBus
|
||||
{
|
||||
private DrawningBus _bus;
|
||||
|
||||
private event BusDelegate? _busDelegate;
|
||||
private event Action<DrawningBus> _busDelegate;
|
||||
|
||||
public FormBusConfig()
|
||||
{
|
||||
@ -34,7 +34,7 @@ namespace AccordionBus
|
||||
buttonCancel.Click += (sender, e) => Close();
|
||||
}
|
||||
|
||||
public void AddEvent(BusDelegate busDelegate)
|
||||
public void AddEvent(Action<DrawningBus> busDelegate)
|
||||
{
|
||||
_busDelegate += busDelegate;
|
||||
}
|
||||
@ -84,7 +84,7 @@ namespace AccordionBus
|
||||
break;
|
||||
case "labelModifiedObject":
|
||||
_bus = new DrawningAccordionBus((int)numericUpDownSpeed.Value, (double)numericUpDownWeight.Value, Color.White,
|
||||
Color.Black, checkBoxOnePart.Checked, checkBoxFiveDoors.Checked);
|
||||
Color.Black, checkBoxHatch.Checked, checkBoxFiveDoors.Checked);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -176,7 +176,7 @@ namespace AccordionBus
|
||||
{
|
||||
if (_bus != null)
|
||||
{
|
||||
_busDelegate?.Invoke(_bus);
|
||||
_busDelegate.Invoke(_bus);
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user