Esempio n. 1
0
        /// <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)
                    {
                        XPanderPanel xpanderPanel =
                            control as XPanderPanel;

                        if (xpanderPanel != null)
                        {
                            if (xpanderPanel.Visible == true)
                            {
                                xpanderPanel.Expand = true;
                                return;
                            }
                        }
                    }
                }
            }
#if DEBUG
            //System.Diagnostics.Trace.WriteLine("Visibility: " + this.Name + this.Visible);
#endif
            CalculatePanelHeights();
        }
Esempio n. 2
0
        private int GetTopPosition()
        {
            int iTopPosition     = this.Padding.Top;
            int iNextTopPosition = 0;

            //The next top position is the highest top value + that controls height, with a
            //little vertical spacing thrown in for good measure
            IEnumerator enumerator = this.XPanderPanels.GetEnumerator();

            while (enumerator.MoveNext())
            {
                XPanderPanel xpanderPanel = (XPanderPanel)enumerator.Current;

                if (xpanderPanel.Visible == true)
                {
                    if (iNextTopPosition == this.Padding.Top)
                    {
                        iTopPosition = this.Padding.Top;
                    }
                    else
                    {
                        iTopPosition = iNextTopPosition;
                    }
                    iNextTopPosition = iTopPosition + xpanderPanel.Height;
                }
            }
            return(iTopPosition);
        }
Esempio n. 3
0
        private void XPanderPanelCaptionClick(object sender, PEIS.XPanderPanelClickEventArgs e)
        {
            XPanderPanel xpanderPanel = sender as XPanderPanel;

            if (xpanderPanel != null)
            {
                this.Expand(xpanderPanel);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Raises the ControlRemoved event.
        /// </summary>
        /// <param name="e">A ControlEventArgs that contains the event data.</param>
        protected override void OnControlRemoved(System.Windows.Forms.ControlEventArgs e)
        {
            base.OnControlRemoved(e);

            XPanderPanel xpanderPanel =
                e.Control as XPanderPanel;

            if (xpanderPanel != null)
            {
                xpanderPanel.CaptionClick -= new EventHandler <XPanderPanelClickEventArgs>(this.XPanderPanelCaptionClick);
            }
        }
Esempio n. 5
0
        int IList.Add(object value)
        {
            XPanderPanel xpanderPanel = value as XPanderPanel;

            if (xpanderPanel == null)
            {
                throw new ArgumentException(string.Format(System.Globalization.CultureInfo.CurrentUICulture,
                                                          Resources.IDS_ArgumentException,
                                                          typeof(XPanderPanel).Name));
            }
            this.Add(xpanderPanel);
            return(this.IndexOf(xpanderPanel));
        }
Esempio n. 6
0
 /// <summary>
 /// expands the specified xpanderpanel
 /// </summary>
 /// <param name="xpanderPanel">xpanderpanel for expand</param>
 public void Expand(XPanderPanel xpanderPanel)
 {
     if (xpanderPanel == null)
     {
         throw new ArgumentException(
                   string.Format(System.Globalization.CultureInfo.CurrentUICulture,
                                 Resources.IDS_ArgumentException,
                                 typeof(XPanderPanel).Name));
     }
     else
     {
         foreach (XPanderPanel tmpXPanderPanel in this.m_xpanderPanels)
         {
             if (tmpXPanderPanel.Equals(xpanderPanel) == false)
             {
                 tmpXPanderPanel.Expand = false;
             }
         }
         xpanderPanel.Expand = true;
     }
 }
Esempio n. 7
0
        /// <summary>
        /// Raises the ControlAdded event.
        /// </summary>
        /// <param name="e">A ControlEventArgs that contains the event data.</param>
        protected override void OnControlAdded(System.Windows.Forms.ControlEventArgs e)
        {
            base.OnControlAdded(e);
            XPanderPanel xpanderPanel = e.Control as XPanderPanel;

            if (xpanderPanel != null)
            {
                if (xpanderPanel.Expand == true)
                {
                    foreach (XPanderPanel tmpXPanderPanel in this.XPanderPanels)
                    {
                        if (tmpXPanderPanel != xpanderPanel)
                        {
                            tmpXPanderPanel.Expand = false;
                            tmpXPanderPanel.Height = xpanderPanel.CaptionHeight;
                        }
                    }
                }
                xpanderPanel.Parent = this;
                xpanderPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                                                                            | System.Windows.Forms.AnchorStyles.Right)));
                xpanderPanel.Left  = this.Padding.Left;
                xpanderPanel.Width = this.ClientRectangle.Width
                                     - this.Padding.Left
                                     - this.Padding.Right;
                xpanderPanel.PanelStyle    = this.PanelStyle;
                xpanderPanel.ShowBorder    = this.ShowBorder;
                xpanderPanel.ColorScheme   = this.ColorScheme;
                xpanderPanel.Top           = this.GetTopPosition();
                xpanderPanel.CaptionClick += new EventHandler <XPanderPanelClickEventArgs>(this.XPanderPanelCaptionClick);
            }
            else
            {
                throw new InvalidOperationException("Can only add XPanderPanel");
            }
        }
Esempio n. 8
0
        private void CalculatePanelHeights()
        {
            if (this.Parent == null)
            {
                return;
            }

            int iPanelHeight = this.Parent.Padding.Top;

            foreach (Control control in this.Parent.Controls)
            {
                XPanderPanel xpanderPanel =
                    control as XPanderPanel;

                if (xpanderPanel != null)
                {
                    if (xpanderPanel.Visible == true)
                    {
                        iPanelHeight += this.CaptionHeight;
                    }
                }
            }

            iPanelHeight += this.Parent.Padding.Bottom;

            foreach (Control control in this.Parent.Controls)
            {
                XPanderPanel xpanderPanel =
                    control as XPanderPanel;

                if (xpanderPanel != null)
                {
                    if (xpanderPanel.Expand == true)
                    {
                        xpanderPanel.Height = this.Parent.Height
                                              + this.CaptionHeight
                                              - iPanelHeight;
                    }
                    else
                    {
                        xpanderPanel.Height = this.CaptionHeight;
                    }
                }
            }

            int iTop = this.Parent.Padding.Top;

            foreach (Control control in this.Parent.Controls)
            {
                XPanderPanel xpanderPanel =
                    control as XPanderPanel;

                if (xpanderPanel != null)
                {
                    if (xpanderPanel.Visible == true)
                    {
                        xpanderPanel.Top = iTop;
                        iTop            += xpanderPanel.Height;
                    }
                }
            }
        }
Esempio n. 9
0
 /// <summary>
 /// Inserts an XPanderPanel to the collection at the specified index.
 /// </summary>
 /// <param name="index">The zero-based index at which value should be inserted. </param>
 /// <param name="xpanderPanel">The XPanderPanel to insert into the Collection.</param>
 public void Insert(int index, XPanderPanel xpanderPanel)
 {
     ((IList)this).Insert(index, (object)xpanderPanel);
 }
Esempio n. 10
0
 /// <summary>
 /// Returns the index of the specified XPanderPanel in the collection.
 /// </summary>
 /// <param name="xpanderPanel">The xpanderPanel to find the index of.</param>
 /// <returns>The index of the xpanderPanel, or -1 if the xpanderPanel is not in the <see ref="ControlCollection">ControlCollection</see> instance.</returns>
 public int IndexOf(XPanderPanel xpanderPanel)
 {
     return(this.m_controlCollection.IndexOf(xpanderPanel));
 }
Esempio n. 11
0
 /// <summary>
 /// Removes the first occurrence of a specific XPanderPanel from the XPanderPanelCollection
 /// </summary>
 /// <param name="value">The XPanderPanel to remove from the XPanderPanelCollection</param>
 public void Remove(XPanderPanel xpanderPanel)
 {
     this.m_controlCollection.Remove(xpanderPanel);
 }
Esempio n. 12
0
 /// <summary>
 /// Adds a XPanderPanel to the collection.
 /// </summary>
 /// <param name="xpanderPanel">The XPanderPanel to add.</param>
 public void Add(XPanderPanel xpanderPanel)
 {
     this.m_controlCollection.Add(xpanderPanel);
     this.m_xpanderPanelList.Invalidate();
 }
Esempio n. 13
0
 /// <summary>
 /// Determines whether the XPanderPanelCollection contains a specific XPanderPanel
 /// </summary>
 /// <param name="value">The XPanderPanel to locate in the XPanderPanelCollection</param>
 /// <returns>true if the XPanderPanelCollection contains the specified value; otherwise, false.</returns>
 public bool Contains(XPanderPanel xpanderPanel)
 {
     return(this.m_controlCollection.Contains(xpanderPanel));
 }