110,535
社区成员
发帖
与我相关
我的任务
分享
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;
}
//没有渐变效果意思下
private int _iStep; //步长
private void simpleButton1_MouseEnter(object sender, EventArgs e)
{
simpleButton1.Top -= _iStep;
simpleButton1.Left -= _iStep;
simpleButton1.Width += 2*_iStep;
simpleButton1.Height += 2*_iStep;
}
private void simpleButton1_MouseLeave(object sender, EventArgs e)
{
simpleButton1.Top += _iStep;
simpleButton1.Left += _iStep;
simpleButton1.Width -= 2*_iStep;
simpleButton1.Height -= 2*_iStep;
}
private void timer1_Tick(object sender, EventArgs e)
{
if (simpleButton1.Height < 50 )
{
simpleButton1.Height += 3;
simpleButton1.Location = new System.Drawing.Point(simpleButton1.Location.X - 3, simpleButton1.Location.Y);
}
if (simpleButton1.Width < 100)
{
simpleButton1.Width += 6;
simpleButton1.Location = new System.Drawing.Point(simpleButton1.Location.X, simpleButton1.Location.Y-6);
}
}
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;
simpleButton1.Location = new System.Drawing.Point(simpleButton1.Location.X, simpleButton1.Location.Y+ 6);
}
if (simpleButton1.Height > 23)
{
simpleButton1.Height -= 3;
simpleButton1.Location = new System.Drawing.Point(simpleButton1.Location.X + 3, simpleButton1.Location.Y);
}
}
private void simpleButton1_MouseLeave(object sender, EventArgs e)
{
timer1.Enabled = false;
timer2.Enabled = true;
}