I have this code below. It is only a Form
and a Label
. You have to alter the colors over time of% co_of% seconds, in this example I put% co_of% ms to see the change. As long as 0.05
is white, 500
has to be black, then change backwards, that is, the form of white is black and the letters of Form
of black to white so for each certain weather. Never show Label
on screen.
using System.Drawing;
using System.Threading;
using System.Windows.Forms;
namespace Apruebalos_a_todos_cs
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
while (true)
{
cambioColor();
Thread.Sleep(500);
cambioColor2();
Thread.Sleep(500);
}
}
void cambioColor()
{
this.BackColor = Color.Black; // Formulario negro.
//this.ForeColor = Color.White; // Cambia textos en blanco.
label1.ForeColor = Color.White;
}
void cambioColor2()
{
this.BackColor = Color.White; // Formulario blanco.
//this.ForeColor = Color.Black; // Cambia textos en negro.
label1.ForeColor = Color.Black;
}
}
}
What am I doing wrong?
Greetings.