I am building a C# movie theater program. On Form1, when clicking on "Reserve" button I want the 21 buttons on Form 2 to randomly change 6 seats to "Red". I would like for it to be different seats every time the "Reserve" button is pressed on Form 1.
Here is the code I am trying to make work.
Random random = new Random();
private Color GetRandomColor()
{
return Color.FromArgb(random.Next(0, 255), random.Next(0, 255), random.Next(0, 255));
}
private void reserve_button_Click(object sender, EventArgs e)
{
button1.BackColor = GetRandomColor();
button2.BackColor = GetRandomColor();
button3.BackColor = GetRandomColor();
button4.BackColor = GetRandomColor();
}
Movie Menu Picture Seating Selection
Aucun commentaire:
Enregistrer un commentaire