字体每隔一秒变大或变小
在窗体中显示字符,字体每隔一秒变大些,变到一定寸尺后,每隔一秒字体又变小些,增加一个按钮,可以启动和停止字符串字体的大小,是怎样做的呢???????
我做的:
int a = 9;
int b = 9;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
timer1.Interval = 1000;
timer1.Enabled = false;
toolTip1.SetToolTip(button1, "启动定时控件");
toolTip1.SetToolTip(button2, "停止定时控件");
}
private void button1_Click(object sender, EventArgs e)
{
timer1.Enabled = true;
}
private void button2_Click(object sender, EventArgs e)
{
timer1.Enabled = false;
}
private void timer1_Tick(object sender, EventArgs e)
{
if(a<30&&b==9)
{
a++;
label1.Font = new Font("",a);
if (a == 30)
b = 30;
}
if (b <30&&a == 30)
{
b--;
label1.Font = new Font("",b);
if (b == 9)
a = 9;
}
label1.ForeColor = Color.Red;
}