Лабораторная №2

This commit is contained in:
yuliya.mavrina@internet.ru 2023-12-16 19:41:28 +03:00
parent 01b6de30dd
commit 1c2170a64a

View File

@ -26,14 +26,7 @@ namespace DoubleDeckerBus_Hard
private void buttonCreateBus_Click(object sender, EventArgs e) private void buttonCreateBus_Click(object sender, EventArgs e)
{ {
Random random = new(); Random random = new();
Color color = Color.FromArgb(random.Next(0, 256), _drawningBus = new DrawningBus(random.Next(100, 300),random.Next(1000, 3000), Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
random.Next(0, 256), random.Next(0, 256));
ColorDialog dialog = new();
if (dialog.ShowDialog() == DialogResult.OK)
{
color = dialog.Color;
}
_drawningBus = new DrawningBus(random.Next(100, 300),random.Next(1000, 3000), color,
pictureBoxBus.Width, pictureBoxBus.Height, random.Next(2, 6), random.Next(0, 4)); pictureBoxBus.Width, pictureBoxBus.Height, random.Next(2, 6), random.Next(0, 4));
_drawningBus.SetPosition(random.Next(10, 100), random.Next(10,100)); _drawningBus.SetPosition(random.Next(10, 100), random.Next(10,100));
Draw(); Draw();
@ -42,21 +35,8 @@ namespace DoubleDeckerBus_Hard
private void buttonCreatDoubleDeckerBus_Click(object sender, EventArgs e) private void buttonCreatDoubleDeckerBus_Click(object sender, EventArgs e)
{ {
Random random = new(); Random random = new();
Color color = Color.FromArgb(random.Next(0, 256), _drawningBus = new DrawningDoubleDeckerBus(random.Next(100, 300), random.Next(1000, 3000), Color.FromArgb(random.Next(0, 256), random.Next(0, 256),
random.Next(0, 256), random.Next(0, 256)); random.Next(0, 256)), Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
ColorDialog dialogColor = new();
if (dialogColor.ShowDialog() == DialogResult.OK)
{
color = dialogColor.Color;
}
Color dopColor = Color.FromArgb(random.Next(0, 256),
random.Next(0, 256), random.Next(0, 256));
ColorDialog dialogDopColor = new();
if (dialogDopColor.ShowDialog() == DialogResult.OK)
{
dopColor = dialogDopColor.Color;
}
_drawningBus = new DrawningDoubleDeckerBus(random.Next(100, 300), random.Next(1000, 3000), color, dopColor,
Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)), random.Next(2, 6), Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)), random.Next(2, 6),
Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)), pictureBoxBus.Width, pictureBoxBus.Height, random.Next(0, 4)); Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)), pictureBoxBus.Width, pictureBoxBus.Height, random.Next(0, 4));
_drawningBus.SetPosition(random.Next(10, 100), random.Next(10, 100)); _drawningBus.SetPosition(random.Next(10, 100), random.Next(10, 100));