Morozov V.S. LabWork3 #3

Closed
VoldemarProger wants to merge 5 commits from LabWork3 into LabWork2
2 changed files with 22 additions and 10 deletions
Showing only changes of commit cceb17014c - Show all commits

View File

@ -29,10 +29,13 @@ namespace AirPlaneWithRadar
private void ButtonCreate_Click(object sender, EventArgs e)
{
Random rnd = new();
_plain = new DrawingPlain(rnd.Next(100, 300), rnd.Next(1000, 2000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)));
Color color = Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256));
ColorDialog dialog = new();
if (dialog.ShowDialog() == DialogResult.OK)
{
color = dialog.Color;
}
_plain = new DrawingPlain(rnd.Next(100, 300), rnd.Next(1000, 2000), color);
SetData();
Draw();
}
@ -67,13 +70,22 @@ namespace AirPlaneWithRadar
{
Random rnd = new();
Color color = Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256));
ColorDialog dialog = new();
if (dialog.ShowDialog() == DialogResult.OK)
{
color = dialog.Color;
}
Color dopColor = Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256));
ColorDialog dialogDop = new();
if (dialogDop.ShowDialog() == DialogResult.OK)
{
dopColor = dialogDop.Color;
}
_plain = new DrawingRadarPlane(rnd.Next(100, 300), rnd.Next(1000, 2000),
Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)),
Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)),
color,
dopColor,
Convert.ToBoolean(rnd.Next(0, 2)), Convert.ToBoolean(rnd.Next(0, 2)));
SetData();
Draw();
}

View File

@ -63,7 +63,7 @@ namespace AirPlaneWithRadar
public T Remove(int position)
{
T mid;
if (_places[position] != null)
if (_places[position] != null && position < _places.Length)
{
mid = _places[position];
_places[position] = null;