我的实现代码是:
private void timer1_Tick(object sender, EventArgs e)
{
if (simpleButton1.Height < 50 )
{
simpleButton1.Height += 3;
}
if (simpleButton1.Width < 100)
{
simpleButton1.Width += 6;
simpleButton1.Size = "1,1";
}
}
private void simpleButton1_MouseEnter(object sender, EventArgs e)
{
timer1.Enabled = true;
timer2.Enabled = false;
}
private void timer2_Tick(object sender, EventArgs e)
{
if ( simpleButton1.Width > 46)
{
simpleButton1.Width -= 6;
}
if (simpleButton1.Height > 23)
{
simpleButton1.Height -= 3;
}
}
private void simpleButton1_MouseLeave(object sender, EventArgs e)
{
timer1.Enabled = false;
timer2.Enabled = true;
}
这样有一个问题就是,他的改变是将左上角的一点固定然后进行放大和缩小,看着很僵硬,我想知道,可不可以让这个button从他的中心开始放大和缩小。。本人是新手,希望各位高手不吝赐教。。小弟这里谢过了