Button控件组,通过改变按钮的背景色来达到以上效果,请各位大虾赐教,不胜感激!!!
using System;
using System.Windows.Forms;
using System.Drawing;
namespace LessonManager
{
///
/// Class3 的摘要说明。
///
class ButtonEx:Button
{
private Timer timer = new Timer();
public delegate void ChangColor(Color c);
public ButtonEx()
{
timer.Enabled = true;
timer.Interval = 500;
timer.Tick += new EventHandler(timer_Tick);
}
void timer_Tick(object sender, EventArgs e)
{
if (this.BackColor == Color.Transparent)
{
this.BackColor=Color.Green;
}
else
{
this.BackColor=(Color.Transparent);
}
}
private void Changing(Color c)
{
this.BackColor=c;
}
protected override void Dispose(bool disposing)
{
this.timer.Enabled = false;
this.timer.Dispose();
base.Dispose(disposing);
}
}
}
补充说明:是有多个按钮,依次改变其背景色,不是一个按钮出现闪动效果,用timer实现,请大神指点啊!!急求!!!
不只一个按钮,多个按钮才有效果
不只一个按钮,多个按钮才有效果