Beispiel #1
0
        /// <summary>
        /// Обработка нажатия кнопки "Создать"
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonCreate_Click(object sender, EventArgs e)
        {
            Random rnd = new Random();

            _car = new SportCar();
            bool sportLine = false;

            if (rnd.Next(2) % 2 == 0)
            {
                sportLine = true;
            }
            _car.Init(rnd.Next(100, 300), rnd.Next(1000, 2000), Color.Blue, Color.Yellow, sportLine, true, true, true);
            _car.SetPosition(rnd.Next(10, 100), rnd.Next(100, 200), pictureBoxCars.Width, pictureBoxCars.Height);
            Draw();
        }