public static void fadingForm(AlphaForm _obj, Bitmap _bmp, double _transparency, int _speed) { Bitmap FadingBmp = UiControlsMethod.ControlMethods.getFormControlToBmp(_obj, _bmp); _obj.BlendedBackground = FadingBmp; Thread fading = new Thread(() => { _obj.CrossThreadCalls(() => { for (double i = 0; i < _transparency; i += 0.01 * _speed) { _obj.SetOpacity(i); Thread.Sleep(10); } _obj.SetOpacity(_transparency); }); }); fading.Start(); }
private void getAnimationPutState() { bool _state = true; while (true) { if (putForm.AnimationBegin) { if (_state) { firstForm.CrossThreadCalls(() => { Thread.Sleep(10); // the same as [ AnimationPutForm.Timer.Interval * 2, becsuse flip delayed] firstForm.Visible = false; firstForm.SetOpacity(0); }); _state = false; } } if (!putForm.AnimationStart) { secondForm.CrossThreadCalls(() => { try { secondForm.Location = firstForm.Location; secondForm.Visible = true; secondForm.SetOpacity((transparency / 255)); } catch { } }); Thread.Sleep(5); // the same as [ AnimationPutForm.Timer.Interval ] putForm.AnimationStart = true; putForm.PutForm_Close(); break; } } }