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)
                    {
                        BaseControls.XPander.XPanderPanel xpanderPanel =
                            control as BaseControls.XPander.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 void XPanderPanelCloseClick(object sender, EventArgs e)
 {
     BaseControls.XPander.XPanderPanel xpanderPanel = sender as BaseControls.XPander.XPanderPanel;
     if (xpanderPanel != null)
     {
         this.Controls.Remove(xpanderPanel);
     }
 }
Esempio n. 3
0
 private void XPanderPanelExpandClick(object sender, EventArgs e)
 {
     BaseControls.XPander.XPanderPanel xpanderPanel = sender as BaseControls.XPander.XPanderPanel;
     if (xpanderPanel != null)
     {
         this.Expand(xpanderPanel);
     }
 }
Esempio n. 4
0
        private void CalculatePanelHeights()
        {
            if (this.Parent == null)
            {
                return;
            }

            int iPanelHeight = this.Parent.Padding.Top;

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

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

            iPanelHeight += this.Parent.Padding.Bottom;

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

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

            int iTop = this.Parent.Padding.Top;

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

                if ((xpanderPanel != null) && (xpanderPanel.Visible == true))
                {
                    xpanderPanel.Top = iTop;
                    iTop            += xpanderPanel.Height;
                }
            }
        }
Esempio n. 5
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);

            BaseControls.XPander.XPanderPanel xpanderPanel =
                e.Control as BaseControls.XPander.XPanderPanel;

            if (xpanderPanel != null)
            {
                xpanderPanel.PanelStyleChanged -= new EventHandler <PanelStyleChangeEventArgs>(XpanderPanelPanelStyleChanged);
                xpanderPanel.ExpandClick       -= new EventHandler <EventArgs>(this.XPanderPanelExpandClick);
                xpanderPanel.CloseClick        -= new EventHandler <EventArgs>(this.XPanderPanelCloseClick);
            }
        }
Esempio n. 6
0
        /// <summary>
        /// Creates a new instance of the specified collection item type.
        /// </summary>
        /// <param name="ItemType">The type of item to create.</param>
        /// <returns> A new instance of the specified object.</returns>
        protected override Object CreateInstance(Type ItemType)
        {
            /* you can create the new instance yourself
             * ComplexItem ci=new ComplexItem(2,"ComplexItem",null);
             * we know for sure that the itemType it will always be ComplexItem
             * but this time let it to do the job...
             */

            BaseControls.XPander.XPanderPanel xpanderPanel =
                (BaseControls.XPander.XPanderPanel)base.CreateInstance(ItemType);

            if (this.Context.Instance != null)
            {
                xpanderPanel.Expand = true;
            }
            return(xpanderPanel);
        }
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);
     BaseControls.XPander.XPanderPanel xpanderPanel = e.Control as BaseControls.XPander.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.ShowCloseIcon      = this.m_bShowCloseIcon;
         xpanderPanel.ShowExpandIcon     = this.m_bShowExpandIcon;
         xpanderPanel.CaptionStyle       = this.m_captionStyle;
         xpanderPanel.Top                = this.GetTopPosition();
         xpanderPanel.PanelStyleChanged += new EventHandler <PanelStyleChangeEventArgs>(XpanderPanelPanelStyleChanged);
         xpanderPanel.ExpandClick       += new EventHandler <EventArgs>(this.XPanderPanelExpandClick);
         xpanderPanel.CloseClick        += new EventHandler <EventArgs>(this.XPanderPanelCloseClick);
     }
     else
     {
         throw new InvalidOperationException("Can only add Windows.Forms.XPanderPanel");
     }
 }