public void CreateContainer() { if (!base.DesignMode) { DockManager.RegisterWindow(this); this.controlContainer.Dock = DockStyle.Fill; int count = base.Controls.Count; int num2 = 0; if (!base.Controls.Contains(this.controlContainer)) { this.controlContainer.Dock = DockStyle.None; base.Controls.Add(this.controlContainer); this.controlContainer.Location = Point.Empty; this.controlContainer.Size = base.ClientSize; Size size = Size.Subtract(base.Size, base.ClientSize); if (!this.MinimumSize.IsEmpty) { this.controlContainer.MinFormSize = Size.Subtract(this.MinimumSize, size); } if (!this.MaximumSize.IsEmpty) { this.controlContainer.MaxFormSize = Size.Subtract(this.MaximumSize, size); } } while (base.Controls.Count > num2) { if (base.Controls[0] != this.controlContainer) { Control control = base.Controls[num2]; base.Controls.Remove(control); if (control != null) { this.controlContainer.Controls.Add(control); } } else { num2 = 1; } } this.controlContainer.Dock = DockStyle.Fill; } }
internal bool ReadXml(XmlReader reader) { try { string str; int width = 100; int height = 100; string attribute = reader.GetAttribute("dock"); if (attribute == null) { goto Label_0093; } if (!(attribute == "Fill")) { if (attribute == "Top") { goto Label_006B; } if (attribute == "Bottom") { goto Label_0075; } if (attribute == "Left") { goto Label_007F; } if (attribute == "Right") { goto Label_0089; } goto Label_0093; } this.Dock = DockStyle.Fill; goto Label_009B; Label_006B: this.Dock = DockStyle.Top; goto Label_009B; Label_0075: this.Dock = DockStyle.Bottom; goto Label_009B; Label_007F: this.Dock = DockStyle.Left; goto Label_009B; Label_0089: this.Dock = DockStyle.Right; goto Label_009B; Label_0093: return(false); Label_009B: str = reader.GetAttribute("width"); if (str != null) { width = int.Parse(str); } str = reader.GetAttribute("height"); if (str != null) { height = int.Parse(str); } str = reader.GetAttribute("type"); if (str == null) { return(false); } System.Type type = System.Type.GetType(str, true); if (type == null) { return(false); } FormLoadEventArgs e = new FormLoadEventArgs(type); DockManager.InvokeFormLoad(this, e); DockWindow form = e.Form; if (e.Cancel) { return(false); } if (form == null) { ConstructorInfo constructor = type.GetConstructor(System.Type.EmptyTypes); if (constructor == null) { return(false); } form = constructor.Invoke(new object[0]) as DockWindow; } base.Size = form.ControlContainer.Size; int count = form.ControlContainer.Controls.Count; if (count > 0) { Control[] array = new Control[count]; form.ControlContainer.Controls.CopyTo(array, 0); base.Controls.AddRange(array); } base.Size = new Size(width, height); form.ControlContainer = this; this.form = form; form.ShowFormAtOnLoad = false; form.Show(); form.ShowFormAtOnLoad = true; if (form.HostContainer != null) { form.Release(); } form.ReadXml(reader); } catch (Exception exception) { Console.WriteLine("DockPanel.ReadXml: " + exception.Message); } return(true); }
protected override void OnActivated(EventArgs e) { base.OnActivated(e); DockManager.FormActivated(this); }