【发布时间】:2015-08-06 13:31:33
【问题描述】:
我希望我的程序不断更改字体背景颜色,但我希望它顺利进行,所以我尝试修改颜色变量 Color custom; 并将其用于表单 this.BackColor = custom; 的背景颜色,但它没有'不工作,我不知道如何使它工作,这是完整的代码:
private void Principal_Load(object sender, EventArgs e)
{
Color custom;
int contr = 0, contg = 0, contb = 0;
do
{
while (contr < 255 && contg == 0)
{
if (contb != 0)
{
contb--;
}
contr++;
while (contg < 255 && contb == 0)
{
if (contr != 0)
{
contr--;
}
contg++;
while (contb < 255 && contr == 0)
{
if (contg != 0)
{
contg--;
}
contb++;
}
}
}
custom = Color.FromArgb(contr, contg, contb);
this.BackColor = custom;
} while (true);
}
【问题讨论】:
-
它可以工作,但可能变化太快。
-
当我运行它时它只显示为半透明