public void UpdateMainForm(TCustomForm AForm) { if (MainForm == null && FCreatingFormType == AForm.GetType() && /* !IsDisposing && */ !AForm.IsMdiChild && !AForm.IsSplash) { MainForm = AForm; } }
public static IContainer GetParentContainer(this IComponent comp) { if (!(comp is TCustomForm) && comp.Site != null) { return(comp.Site.Container); } if (comp is Control) { TCustomForm form = ((Control)comp).FindForm() as TCustomForm; if (form != null) { return(form.Site.Container); } } return(null); }
public void CreateForm <TComponent>(out TComponent comp) where TComponent : Component, new() { bool ok = false; try { if (FCreatingFormType == null && typeof(TCustomForm).IsAssignableFrom(typeof(TComponent))) { FCreatingFormType = typeof(TComponent); } comp = GenericConstructor <TComponent> .Default.CreateInstance(); ok = true; } finally { if (!ok) { comp = null; if (FCreatingFormType == typeof(TComponent)) { FCreatingFormType = null; } } } if (comp is TCustomForm) { TCustomForm form = comp as TCustomForm; form.AfterConstruction(); UpdateMainForm(form); IntPtr hwnd; if (MainForm == form) { hwnd = form.Handle; // force form to create its handle } if (form.IsSplash) { // show the splash form and handle the paint message form.Show(); form.Invalidate(); Application.DoEvents(); } } }
public SiteWithChildContainer(TCustomForm owner) { this.owner = owner; }