Hi again!
While writing the previous post about generating random numbers I was thinking about doing something cool with that functionality. Then I wrote this code which generates 3 random numbers used as parameters in the “Color.FromArgb” method.
Check it out!
private void button1_Click(object sender, EventArgs e)
{
Random r = new Random();
Color rColor = Color.FromArgb(r.Next(255), r.Next(255),r.Next(255));
this.BackColor = rColor;
}
That color can be applied to a control. I applied it to the Form, and looks like this every time I click the “Action!” button:
No hay comentarios.:
Publicar un comentario