Lab5 error fix
This commit is contained in:
parent
f31ccdc593
commit
3bd218f664
@ -22,5 +22,9 @@ namespace ProjectTrolleybus.Entities
|
||||
Weight = weight;
|
||||
BodyColor = bodyColor;
|
||||
}
|
||||
public void ChangeColor(Color color)
|
||||
{
|
||||
BodyColor = color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,5 +22,10 @@ namespace ProjectTrolleybus.Entities
|
||||
Roga = roga;
|
||||
Battery = battery;
|
||||
}
|
||||
|
||||
public void ChangeAdditColor(Color color)
|
||||
{
|
||||
AdditionalColor = color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
2
Trolleybus/Trolleybus/FormBusConfig.Designer.cs
generated
2
Trolleybus/Trolleybus/FormBusConfig.Designer.cs
generated
@ -279,7 +279,7 @@
|
||||
labelAdditionalColor.Text = "Доп. цвет";
|
||||
labelAdditionalColor.TextAlign = ContentAlignment.MiddleCenter;
|
||||
labelAdditionalColor.DragDrop += labelAdditionalColor_DragDrop;
|
||||
labelAdditionalColor.DragEnter += labelAdditionalColor_DragEnter;
|
||||
labelAdditionalColor.DragEnter += labelColor_DragEnter;
|
||||
//
|
||||
// labelColor
|
||||
//
|
||||
|
@ -41,8 +41,8 @@ namespace ProjectTrolleybus
|
||||
{
|
||||
Bitmap bmp = new(pictureBoxObject.Width, pictureBoxObject.Height);
|
||||
Graphics gr = Graphics.FromImage(bmp);
|
||||
_bus?.SetPosition(5, 5);
|
||||
_bus?.DrawTransport(gr);
|
||||
_bus?.SetPosition(5, 5);
|
||||
_bus?.DrawTransport(gr);
|
||||
pictureBoxObject.Image = bmp;
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@ namespace ProjectTrolleybus
|
||||
{
|
||||
case "labelSimple":
|
||||
_bus = new DrawingBus((int)numericUpDownSpeed.Value,
|
||||
(int)numericUpDownWeight.Value, Color.White, _pictureWidth, _pictureHeight);
|
||||
(int)numericUpDownWeight.Value, Color.White, _pictureWidth, _pictureHeight);
|
||||
break;
|
||||
case "labelAdvanced":
|
||||
_bus = new DrawingTrolleybus((int)numericUpDownSpeed.Value,
|
||||
@ -113,18 +113,7 @@ namespace ProjectTrolleybus
|
||||
if (_bus == null || _bus.EntityBus == null)
|
||||
return;
|
||||
Color colorBody = (Color)e.Data.GetData(typeof(Color));
|
||||
if (_bus is DrawingTrolleybus == false)
|
||||
{
|
||||
_bus = new DrawingBus((int)numericUpDownSpeed.Value, (int)numericUpDownWeight.Value,
|
||||
colorBody, _pictureWidth, _pictureHeight);
|
||||
}
|
||||
else
|
||||
{
|
||||
_bus = new DrawingTrolleybus((int)numericUpDownSpeed.Value, (int)numericUpDownWeight.Value,
|
||||
colorBody, ((EntityTrolleybus)_bus.EntityBus).AdditionalColor, checkBoxRoga.Checked,
|
||||
checkBoxBattery.Checked, _pictureWidth, _pictureHeight);
|
||||
|
||||
}
|
||||
_bus.EntityBus.ChangeColor(colorBody);
|
||||
DrawBus();
|
||||
}
|
||||
|
||||
@ -145,23 +134,9 @@ namespace ProjectTrolleybus
|
||||
if (_bus == null || _bus.EntityBus == null || _bus is DrawingTrolleybus == false)
|
||||
return;
|
||||
Color colorAdditional = (Color)e.Data.GetData(typeof(Color));
|
||||
_bus = new DrawingTrolleybus((int)numericUpDownSpeed.Value, (int)numericUpDownWeight.Value,
|
||||
_bus.EntityBus.BodyColor, colorAdditional, checkBoxRoga.Checked,
|
||||
checkBoxBattery.Checked, _pictureWidth, _pictureHeight);
|
||||
((EntityTrolleybus)_bus.EntityBus).ChangeAdditColor(colorAdditional);
|
||||
DrawBus();
|
||||
}
|
||||
|
||||
private void labelAdditionalColor_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
if (e.Data.GetDataPresent(typeof(Color)))
|
||||
{
|
||||
e.Effect = DragDropEffects.Copy;
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Effect = DragDropEffects.None;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user