/// <summary> /// Raises the VisibleChanged event. /// </summary> /// <param name="e">An EventArgs that contains the event data.</param> protected override void OnVisibleChanged(EventArgs e) { base.OnVisibleChanged(e); if (this.DesignMode == true) { return; } if (this.Visible == false) { if (this.Expand == true) { this.Expand = false; foreach (Control control in this.Parent.Controls) { XiaoCai.WinformUI.Panels.PanderPanelW PanderPanelW = control as XiaoCai.WinformUI.Panels.PanderPanelW; if (PanderPanelW != null) { if (PanderPanelW.Visible == true) { PanderPanelW.Expand = true; return; } } } } } #if DEBUG //System.Diagnostics.Trace.WriteLine("Visibility: " + this.Name + this.Visible); #endif CalculatePanelHeights(); }
private void CalculatePanelHeights() { if (this.Parent == null) { return; } int iPanelHeight = this.Parent.Padding.Top; foreach (Control control in this.Parent.Controls) { XiaoCai.WinformUI.Panels.PanderPanelW PanderPanelW = control as XiaoCai.WinformUI.Panels.PanderPanelW; if ((PanderPanelW != null) && (PanderPanelW.Visible == true)) { iPanelHeight += PanderPanelW.CaptionHeight; } } iPanelHeight += this.Parent.Padding.Bottom; foreach (Control control in this.Parent.Controls) { XiaoCai.WinformUI.Panels.PanderPanelW PanderPanelW = control as XiaoCai.WinformUI.Panels.PanderPanelW; if (PanderPanelW != null) { if (PanderPanelW.Expand == true) { PanderPanelW.Height = this.Parent.Height + PanderPanelW.CaptionHeight - iPanelHeight; } else { PanderPanelW.Height = PanderPanelW.CaptionHeight; } } } int iTop = this.Parent.Padding.Top; foreach (Control control in this.Parent.Controls) { XiaoCai.WinformUI.Panels.PanderPanelW PanderPanelW = control as XiaoCai.WinformUI.Panels.PanderPanelW; if ((PanderPanelW != null) && (PanderPanelW.Visible == true)) { PanderPanelW.Top = iTop; iTop += PanderPanelW.Height; } } }