/// <summary> /// Fades the out window. /// </summary> /// <param name="currentKryptonWindow">The current krypton window.</param> /// <param name="nextKryptonWindow">The next krypton window.</param> /// <param name="currentWindow">The current window.</param> /// <param name="nextWindow">The next window.</param> /// <param name="fadeOutSleepTimer">The fade out sleep timer.</param> public void FadeOutWindow(KryptonForm currentKryptonWindow, KryptonForm nextKryptonWindow, Form currentWindow = null, Form nextWindow = null, int fadeOutSleepTimer = 50) { for (FadeOut = 90; FadeOut >= 10; FadeOut += -10) { if (nextWindow != null) { nextWindow.Opacity = FadeOut / 100; nextWindow.Refresh(); } else { nextKryptonWindow.Opacity = FadeOut / 100; nextKryptonWindow.Refresh(); } Thread.Sleep(fadeOutSleepTimer); } if (nextWindow != null) { nextWindow.Show(); } else { nextKryptonWindow.Show(); } }
/// <summary> /// Fades the form in. /// Use this in your 'Form_Load' event. /// </summary> /// <param name="kryptonWindow">The krypton window.</param> /// <param name="window">The window.</param> /// <param name="fadeInSleepTimer">The fade in sleep timer.</param> public void FadeInWindow(KryptonForm kryptonWindow, Form window = null, int fadeInSleepTimer = 50) { for (FadeIn = 0.0; FadeIn <= 1.1; FadeIn += 0.1) { if (window != null) { window.Opacity = FadeIn; window.Refresh(); } else { kryptonWindow.Opacity = FadeIn; kryptonWindow.Refresh(); } Thread.Sleep(fadeInSleepTimer); } }