c# Label控件 怎么实现渐变的特效? [align=center]c# 的窗体可以设置Opacity属性 使窗体透明,结合timer 控件还可以实现渐变的效果。Label 控件怎么实现这个效果? 求解!!![/align] 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Label 不是还简单些么?控制Label 的ForeColor不就可以了 for (int i = 0; i < 255; i++) label1.ForeColor = new Color(i, i, i); for (int i = 0; i < 255; i++){ label1.ForeColor = new Color(i, i, i); Application.DoEvents(); Thread.Sleep(100);} 把lable的backColor设为(0,0,0,0)这样就不用管lable了颜色就和你Form一样了,如果一定要lable的颜色也可!把lable重绘一下! 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没有三个参数的重载还有进程问题 你那个方法中不能实现渐变 而是直接改变颜色 发个刷子你自己刷刷看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事件下好像是!你看看 for(int i=0;i<100;i++){Label.BackColor = Color.FromArgb(i, 0, 0, 0);} 加一个Timer,通过Timer控制前景色 记事本程序的几个问题 两个很简单的问题,50分求解! 怎么判断一个object是不是数字 冰天雪地跪地求教!!!!! 帮帮忙呀! 在ASP.NET中做修改和更新的时候出现:“指定的参数已超出有效值的范围” 关于水晶报表安装的问题! winform程序修改配置文件后...求救!!!!! windows 服务如何在指定时间执行写服务里边的一个方法 。 已知有N行,每行有三列,如何做到输出,长度为N,所有数字参与的数组? 如何使用DevExpress GridControl控件代替传统的DataGridView实现表头全选的功能 关于2个窗体的互操作 关于DataTable往数据库中更新的问题!!
label1.ForeColor = new Color(i, i, i);
{
label1.ForeColor = new Color(i, i, i);
Application.DoEvents();
Thread.Sleep(100);
}
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没有三个参数的重载
还有进程问题
你那个方法中不能实现渐变 而是直接改变颜色
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事件下好像是!你看看