public static void initPage(Form childPage, main_page mainPage) { GF.closeChildren(mainPage); GF.showLoading(mainPage); GF.doDebug("========== MAIN FORM :: " + childPage.Name + " =========="); GF.selected_id = 0; childPage.MdiParent = mainPage; if (childPage.Name.IndexOf("report_") != -1) { childPage.Dock = DockStyle.Fill; } else { childPage.Size = childPage.MdiParent.ClientSize; childPage.StartPosition = FormStartPosition.Manual; } childPage.WindowState = FormWindowState.Maximized; GF.addKeyUp(childPage); childPage.Load += (s, e) => { //((Form)s).Visible = true; }; childPage.LocationChanged += (s, e) => { if (childPage.Left != 0) { childPage.Left = -5; } if (childPage.Top != 0) { childPage.Top = 0; } }; if (!childPage.IsDisposed) { childPage.Show(); } GF.closeLoading(); }