Lab5 Done+
This commit is contained in:
parent
ee702973fa
commit
b9751a5fd0
@ -121,7 +121,7 @@ namespace ProjectAirBomber
|
||||
DrawPlane();
|
||||
}
|
||||
|
||||
private void PanelColor_MouseDown(object sender, MouseEventArgs e)
|
||||
private void PanelColor_MouseDown(object? sender, MouseEventArgs e)
|
||||
{
|
||||
(sender as Panel)?.DoDragDrop((sender as Panel)?.BackColor,
|
||||
DragDropEffects.Move | DragDropEffects.Copy);
|
||||
@ -142,17 +142,18 @@ namespace ProjectAirBomber
|
||||
|
||||
private void labelColor_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
if (_plane == null)
|
||||
if (_plane?.EntityPlane == null)
|
||||
return;
|
||||
Color bodyColor = (Color)e.Data.GetData(typeof(Color));
|
||||
if (_plane is DrawingAirBomber)
|
||||
{
|
||||
_plane = new DrawingAirBomber((int)numericUpDownSpeed.Value,
|
||||
(int)numericUpDownWeight.Value, (Color)e.Data.GetData(typeof(Color)), ((EntityAirBomber)_plane.EntityPlane).AdditionalColor, checkBoxBombs.Checked,
|
||||
(int)numericUpDownWeight.Value, bodyColor, ((EntityAirBomber)_plane.EntityPlane).AdditionalColor, checkBoxBombs.Checked,
|
||||
checkBoxFuel.Checked, _pictureWidth, _pictureHeight);
|
||||
} else
|
||||
{
|
||||
_plane = new DrawingPlane((int)numericUpDownSpeed.Value,
|
||||
(int)numericUpDownWeight.Value, (Color)e.Data.GetData(typeof(Color)), _pictureWidth, _pictureHeight);
|
||||
(int)numericUpDownWeight.Value, bodyColor, _pictureWidth, _pictureHeight);
|
||||
}
|
||||
DrawPlane();
|
||||
}
|
||||
@ -171,10 +172,11 @@ namespace ProjectAirBomber
|
||||
|
||||
private void labelAddColor_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
if ((_plane == null) || (_plane is DrawingAirBomber == false))
|
||||
if ((_plane?.EntityPlane == null) || (_plane is DrawingAirBomber == false))
|
||||
return;
|
||||
Color additionalColor = (Color)e.Data.GetData(typeof(Color));
|
||||
_plane = new DrawingAirBomber((int)numericUpDownSpeed.Value,
|
||||
(int)numericUpDownWeight.Value, _plane.EntityPlane.BodyColor, (Color)e.Data.GetData(typeof(Color)), checkBoxBombs.Checked,
|
||||
(int)numericUpDownWeight.Value, _plane.EntityPlane.BodyColor, additionalColor, checkBoxBombs.Checked,
|
||||
checkBoxFuel.Checked, _pictureWidth, _pictureHeight);
|
||||
DrawPlane();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user