【发布时间】:2017-11-29 13:47:31
【问题描述】:
我想知道如何同步更改标签页的颜色和标签背景颜色。
我在计时器中使用的代码是
Random rand = new Random();
int A = rand.Next(0, 255);
int R = rand.Next(0, 255);
int G = rand.Next(0, 255);
int B = rand.Next(0, 255);
tabPage1.BackColor = Color.FromArgb(A, R, G, B)
这是正常情况:without changing the label back colour. changing the back colour.
【问题讨论】:
-
“标签页和背景颜色同步”?你是说标签页的颜色吗?你的意思是只改变一个控件的颜色……对吧?
-
我漏掉了一个字。
-
为什么,不是 Label.BackColor == Color.Transparent 吗??
-
是的,但它会做一些奇怪的事情,比如图片 1
-
您会看到控件轮到自己绘制。绘制事件一次引发一个。摆脱工件需要合成,双缓冲整个窗口而不仅仅是控件。 That is easy to do.
标签: c# winforms visual-studio colors transparency