Изменение создания объекта в классе формы

This commit is contained in:
pgirl1 2022-10-03 15:46:48 +04:00
parent 1e83e26657
commit 17121ead6d

View File

@ -36,8 +36,7 @@ namespace ArmoredCar
private void ButtonCreate_Click(object sender, EventArgs e)
{
Random rnd = new();
_car = new DrawningArmoredCar();
_car.Init(rnd.Next(100, 300), rnd.Next(1000, 2000),
_car = new DrawningArmoredCar(rnd.Next(100, 300), rnd.Next(1000, 2000),
Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)));
_car.SetPosition(rnd.Next(10, 100), rnd.Next(10, 100), pictureBoxCar.Width, pictureBoxCar.Height);