c# Label控件 怎么实现渐变的特效?

fjkfjdkfdfgdfdf 2012-05-01 09:15:06
c# 的窗体可以设置Opacity属性 使窗体透明,结合timer 控件还可以实现渐变的效果。
Label 控件怎么实现这个效果? 求解!!!
...全文
683 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
wangsong145 2012-05-07
  • 打赏
  • 举报
回复
加一个Timer,通过Timer控制前景色
chenzishenars 2012-05-07
  • 打赏
  • 举报
回复
for(int i=0;i<100;i++){

Label.BackColor = Color.FromArgb(i, 0, 0, 0);

}
tigercao101 2012-05-04
  • 打赏
  • 举报
回复
发个刷子你自己刷刷看
using (LinearGradientBrush brush = new LinearGradientBrush(e.CellBounds, Color.LightGray,
Color.White, LinearGradientMode.Vertical))
{
e.Graphics.FillRectangle(brush, e.CellBounds);
Rectangle border = e.CellBounds;
border.Offset(new Point(-1, -1));
e.Graphics.DrawRectangle(Pens.Gray, border);
}
e.PaintContent(e.CellBounds);
e.Handled = true;
在OnPaint事件下好像是!你看看
fjkfjdkfdfgdfdf 2012-05-04
  • 打赏
  • 举报
回复
不行啊! 我都试过了!
anzhiqiang_touzi 2012-05-04
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 的回复:]
private void Form3_Load(object sender, EventArgs e)
Thread th = new Thread(new ThreadStart(NewMethod));
th.IsBackground = true;
th.Start();
}

private void NewMethod()
{
Control.……
[/Quote]
nm8222157 2012-05-04
  • 打赏
  • 举报
回复
private void Form3_Load(object sender, EventArgs e)
Thread th = new Thread(new ThreadStart(NewMethod));
th.IsBackground = true;
th.Start();
}

private void NewMethod()
{
Control.CheckForIllegalCrossThreadCalls = false;
for (int i = 0; i < 255; i++)
{
label1.ForeColor = Color.FromArgb(i, i, i);

Thread.Sleep(100);
}
}
不知道为什么 三楼的方法 我的Color没有三个参数的重载
还有进程问题
你那个方法中不能实现渐变 而是直接改变颜色
tigercao101 2012-05-04
  • 打赏
  • 举报
回复
把lable的backColor设为(0,0,0,0)这样就不用管lable了颜色就和你Form一样了,如果一定要lable的颜色也可!把lable重绘一下!
why0826001 2012-05-04
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 的回复:]
for (int i = 0; i < 255; i++)
{
label1.ForeColor = new Color(i, i, i);
Application.DoEvents();
Thread.Sleep(100);
}
[/Quote]
就可以了
dylike 2012-05-02
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 的回复:]

for (int i = 0; i < 255; i++)
{
label1.ForeColor = new Color(i, 0,0,0);
Application.DoEvents();
Thread.Sleep(100);
}
[/Quote]
devmiao 2012-05-02
  • 打赏
  • 举报
回复
for (int i = 0; i < 255; i++)
{
label1.ForeColor = new Color(i, i, i);
Application.DoEvents();
Thread.Sleep(100);
}
devmiao 2012-05-02
  • 打赏
  • 举报
回复
for (int i = 0; i < 255; i++)
label1.ForeColor = new Color(i, i, i);
熙风 2012-05-02
  • 打赏
  • 举报
回复
Label 不是还简单些么?控制Label 的ForeColor不就可以了

111,126

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧