public static void hideAndShow(Form formToHide, Form formToShow, int step = 10, int sleepTime = 100) { if (formToHide == formToShow || formToHide == null && formToShow == null) { return; } ShowFormInfo info = new ShowFormInfo(formToHide, formToShow, step, sleepTime); new Thread(new ParameterizedThreadStart(changeShow)).Start(info); }
static void changeShow(Object info) { ShowFormInfo sInfo = (ShowFormInfo)info; for (int i = 0; i < sInfo.step; ++i) { if (sInfo.formToHide != null) { sInfo.formToHide.Invoke(sInfo.changeHide, i); } if (sInfo.formToShow != null) { sInfo.formToShow.Invoke(sInfo.changeShow, i); } } }