protected override void OnMouseEnter(EventArgs e) { base.OnMouseEnter(e); DrawString = true; AnimationBack.Stop(); Animation.Start(); //Reset stopwatch sw.Reset(); sw.Stop(); sw.Start(); }
/// <summary> /// Triggered every AnimationBack tick /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ButtonAnimationBack(object sender, EventArgs e) { if (UseSmoothSpeedIncrement) { incremental_x -= Convert.ToInt32(BackgroundSpeed * sw.Elapsed.TotalSeconds * SmoothCorrectionFactor); } else { incremental_x -= BackgroundSpeed; } if (incremental_x <= 0) { AnimationBack.Stop(); incremental_x = 1; } this.Invalidate(); }