protected override void OnControlAdded(ControlEventArgs e) { base.OnControlAdded(e); // ExpandablePanel expandablePanel = e.Control as ExpandablePanel; if (expandablePanel == null) this.Controls.Remove(e.Control); // if (this.ExpandablePanels.Count > 0) { this.ResetDefaultIndex(); // switch (this.eOrientation) { case Orientation.Vertical: this.Width++; this.Width--; break; case Orientation.Horizontal: default: this.Height++; this.Height--; break; } } }
public Size GetWorkRegionSize() { int iCaptionHeight = 0; ExpandablePanel expandablePanel = this.SelectedExpandablePanel; switch (this.eOrientation) { case Orientation.Vertical: foreach (ExpandablePanel one in this.ExpandablePanels) { if (one == null || !one.Visible || one == expandablePanel) continue; iCaptionHeight += one.CaptionHeight + 2; } return new Size(this.DisplayRectangle.Width, this.DisplayRectangle.Height - iCaptionHeight); case Orientation.Horizontal: default: foreach (ExpandablePanel one in this.ExpandablePanels) { if (one == null || !one.Visible || one == expandablePanel) continue; iCaptionHeight += one.CaptionHeight + 2; } return new Size(this.DisplayRectangle.Width - iCaptionHeight, this.DisplayRectangle.Height); } }
public void ResetDefaultIndex() { ExpandablePanel expandablePanel = null; foreach (ExpandablePanel one in this.ExpandablePanels) { if (one == null || !one.Visible || !one.IsExpand) continue; // if (expandablePanel == null) expandablePanel = one; else ((ISetExpandableCaptionPanelHelper)one).SetIsExpand(false); } if (expandablePanel == null) { foreach (ExpandablePanel one in this.ExpandablePanels) { if (one == null || !one.Visible) continue; // ((ISetExpandableCaptionPanelHelper)one).SetIsExpand(true); expandablePanel = one; break; } } // if (expandablePanel != null) ((ISetExpandableCaptionPanelHelper)expandablePanel).ResetSize(); }
public void SetSelectedExpandablePanel(ExpandablePanel expandablePanel) { this.ExpandablePanelSelectedIndex = this.ExpandablePanels.IndexOf(expandablePanel); }