/// <summary>
        /// Raises the PanelCollapsing event.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">A XPanderStateChangeEventArgs that contains the event data.</param>
        protected override void OnPanelCollapsing(object sender, XPanderStateChangeEventArgs e)
        {
            if ((this.Dock == DockStyle.Left) || (this.Dock == DockStyle.Right))
            {
                foreach (Control control in this.Controls)
                {
                    control.Hide();
                }
            }

            if ((this.Dock == DockStyle.Left) || (this.Dock == DockStyle.Right))
            {
                if (this.ClientRectangle.Width > this.CaptionHeight)
                {
                    this.m_restoreBounds = this.ClientRectangle;
                }
                this.Width = this.CaptionHeight;
            }

            if ((this.Dock == DockStyle.Top) || (this.Dock == DockStyle.Bottom))
            {
                if (this.ClientRectangle.Height > this.CaptionHeight)
                {
                    this.m_restoreBounds = this.ClientRectangle;
                }
                this.Height = this.CaptionHeight;
            }

            base.OnPanelCollapsing(sender, e);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Raises the PanelExpanding event.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">A XPanderStateChangeEventArgs that contains the event data.</param>
        protected override void OnPanelExpanding(object sender, XPanderStateChangeEventArgs e)
        {
            bool bExpand = e.Expand;

            if (bExpand == true)
            {
                this.Expand = bExpand;
                this.Invalidate(false);
            }
            base.OnPanelExpanding(sender, e);
        }
        /// <summary>
        /// Raises the PanelExpanding event.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">A XPanderStateChangeEventArgs that contains the event data.</param>
        protected override void OnPanelExpanding(object sender, XPanderStateChangeEventArgs e)
        {
            if ((this.Dock == DockStyle.Left) || (this.Dock == DockStyle.Right))
            {
                foreach (Control control in this.Controls)
                {
                    control.Show();
                }
                //When ClientRectangle.Width > CaptionHeight the panel size has changed
                //otherwise the captionclick event was executed
                if (this.ClientRectangle.Width == this.CaptionHeight)
                {
                    this.Width = this.m_restoreBounds.Width;
                }
            }
            if ((this.Dock == DockStyle.Top) || (this.Dock == DockStyle.Bottom))
            {
                this.Height = this.m_restoreBounds.Height;
            }

            base.OnPanelExpanding(sender, e);
        }