コード例 #1
0
        private int GetTopPosition()
        {
            int iTopPosition     = this.Padding.Top;
            int iNextTopPosition = 0;

            IEnumerator enumerator = this.ExpondPanels.GetEnumerator();

            while (enumerator.MoveNext())
            {
                ExpondPanel expondPanel = (ExpondPanel)enumerator.Current;

                if (expondPanel.Visible == true)
                {
                    if (iNextTopPosition == this.Padding.Top)
                    {
                        iTopPosition = this.Padding.Top;
                    }
                    else
                    {
                        iTopPosition = iNextTopPosition;
                    }
                    iNextTopPosition = iTopPosition + expondPanel.Height;
                }
            }
            return(iTopPosition);
        }
コード例 #2
0
        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)
                    {
                        ExpondPanel expondPanel = control as ExpondPanel;

                        if (expondPanel != null)
                        {
                            if (expondPanel.Visible == true)
                            {
                                expondPanel.Expand = true;
                                return;
                            }
                        }
                    }
                }
            }
#if DEBUG
            //System.Diagnostics.Trace.WriteLine("Visibility: " + this.Name + this.Visible);
#endif
            CalculatePanelHeights();
        }
コード例 #3
0
 public ExpondPanelCaptionGlyph(System.Windows.Forms.Design.Behavior.BehaviorService behaviorService, ExpondPanel expondPanel)
     :
     base(new ExpondPanelCaptionClickBehavior(expondPanel))
 {
     this.m_behaviorService = behaviorService;
     this.m_expondPanel     = expondPanel;
 }
コード例 #4
0
        public void Expand(BasePanel panel)
        {
            if (panel == null)
            {
                throw new ArgumentNullException("panel",
                                                string.Format(System.Globalization.CultureInfo.InvariantCulture,
                                                              StaticResource.IDS_ArgumentException,
                                                              "panel"));
            }

            ExpondPanel expondPanel = panel as ExpondPanel;

            if (expondPanel != null)
            {
                foreach (ExpondPanel tmpExpondPanel in this._expondPanels)
                {
                    if (tmpExpondPanel.Equals(expondPanel) == false)
                    {
                        tmpExpondPanel.Expand = false;
                    }
                }
                PropertyDescriptor propertyDescriptor = TypeDescriptor.GetProperties(expondPanel)["Expand"];
                if (propertyDescriptor != null)
                {
                    propertyDescriptor.SetValue(expondPanel, true);
                }
            }
        }
コード例 #5
0
        private void ExpondPanelCloseClick(object sender, EventArgs e)
        {
            ExpondPanel expondPanel = sender as ExpondPanel;

            if (expondPanel != null)
            {
                this.Controls.Remove(expondPanel);
            }
        }
コード例 #6
0
        private void ExpondPanelExpandClick(object sender, EventArgs e)
        {
            ExpondPanel expondPanel = sender as ExpondPanel;

            if (expondPanel != null)
            {
                this.Expand(expondPanel);
            }
        }
コード例 #7
0
        protected override Object CreateInstance(Type ItemType)
        {
            ExpondPanel expondPanel = (ExpondPanel)base.CreateInstance(ItemType);

            if (this.Context.Instance != null)
            {
                expondPanel.Expand = true;
            }
            return(expondPanel);
        }
コード例 #8
0
        private void CalculatePanelHeights()
        {
            if (this.Parent == null)
            {
                return;
            }

            int iPanelHeight = this.Parent.Padding.Top;

            foreach (Control control in this.Parent.Controls)
            {
                ExpondPanel expondPanel = control as ExpondPanel;

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

            iPanelHeight += this.Parent.Padding.Bottom;

            foreach (Control control in this.Parent.Controls)
            {
                ExpondPanel expondPanel = control as ExpondPanel;

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

            int iTop = this.Parent.Padding.Top;

            foreach (Control control in this.Parent.Controls)
            {
                ExpondPanel expondPanel = control as ExpondPanel;

                if ((expondPanel != null) && (expondPanel.Visible == true))
                {
                    expondPanel.Top = iTop;
                    iTop           += expondPanel.Height;
                }
            }
        }
コード例 #9
0
        public override void Initialize(IComponent component)
        {
            base.Initialize(component);
            ExpondPanel expondPanel = Control as ExpondPanel;

            if (expondPanel != null)
            {
                this.m_adorner = new System.Windows.Forms.Design.Behavior.Adorner();
                BehaviorService.Adorners.Add(this.m_adorner);
                this.m_adorner.Glyphs.Add(new ExpondPanelCaptionGlyph(BehaviorService, expondPanel));
            }
        }
コード例 #10
0
        private static void DrawInnerBorders(Graphics graphics, ExpondPanel expondPanel)
        {
            if (expondPanel.ShowBorder == true)
            {
                using (GraphicsPath graphicsPath = new GraphicsPath())
                {
                    Rectangle       captionRectangle = expondPanel.CaptionRectangle;
                    ExpondPanelList expondPanelList  = expondPanel.Parent as ExpondPanelList;
                    if ((expondPanelList != null) && (expondPanelList.Dock == DockStyle.Fill))
                    {
                        PanelEx     panel             = expondPanelList.Parent as PanelEx;
                        ExpondPanel parentExpondPanel = expondPanelList.Parent as ExpondPanel;
                        if (((panel != null) && (panel.Padding == new Padding(0))) ||
                            ((parentExpondPanel != null) && (parentExpondPanel.Padding == new Padding(0))))
                        {
                            //Left vertical borderline
                            graphicsPath.AddLine(captionRectangle.X, captionRectangle.Y + captionRectangle.Height, captionRectangle.X, captionRectangle.Y + StaticResource.BorderThickness);
                            if (expondPanel.Top == 0)
                            {
                                //Upper horizontal borderline
                                graphicsPath.AddLine(captionRectangle.X, captionRectangle.Y, captionRectangle.X + captionRectangle.Width, captionRectangle.Y);
                            }
                            else
                            {
                                //Upper horizontal borderline
                                graphicsPath.AddLine(captionRectangle.X, captionRectangle.Y + StaticResource.BorderThickness, captionRectangle.X + captionRectangle.Width, captionRectangle.Y + StaticResource.BorderThickness);
                            }
                        }
                    }
                    else
                    {
                        //Left vertical borderline
                        graphicsPath.AddLine(captionRectangle.X + StaticResource.BorderThickness, captionRectangle.Y + captionRectangle.Height, captionRectangle.X + StaticResource.BorderThickness, captionRectangle.Y);
                        if (expondPanel.Top == 0)
                        {
                            //Upper horizontal borderline
                            graphicsPath.AddLine(captionRectangle.X + StaticResource.BorderThickness, captionRectangle.Y + StaticResource.BorderThickness, captionRectangle.X + captionRectangle.Width - StaticResource.BorderThickness, captionRectangle.Y + StaticResource.BorderThickness);
                        }
                        else
                        {
                            //Upper horizontal borderline
                            graphicsPath.AddLine(captionRectangle.X + StaticResource.BorderThickness, captionRectangle.Y, captionRectangle.X + captionRectangle.Width - StaticResource.BorderThickness, captionRectangle.Y);
                        }
                    }

                    using (Pen borderPen = new Pen(expondPanel.PanelColors.InnerBorderColor))
                    {
                        graphics.DrawPath(borderPen, graphicsPath);
                    }
                }
            }
        }
コード例 #11
0
        int IList.Add(object value)
        {
            ExpondPanel expondPanel = value as ExpondPanel;

            if (expondPanel == null)
            {
                throw new ArgumentException(string.Format(System.Globalization.CultureInfo.CurrentUICulture,
                                                          StaticResource.IDS_ArgumentException,
                                                          typeof(ExpondPanel).Name));
            }
            this.Add(expondPanel);
            return(this.IndexOf(expondPanel));
        }
コード例 #12
0
        protected override void OnControlRemoved(System.Windows.Forms.ControlEventArgs e)
        {
            base.OnControlRemoved(e);

            ExpondPanel expondPanel =
                e.Control as ExpondPanel;

            if (expondPanel != null)
            {
                expondPanel.PanelStyleChanged -= new EventHandler <PanelStyleChangeEventArgs>(ExpondPanelPanelStyleChanged);
                expondPanel.ExpandClick       -= new EventHandler <EventArgs>(this.ExpondPanelExpandClick);
                expondPanel.CloseClick        -= new EventHandler <EventArgs>(this.ExpondPanelCloseClick);
            }
        }
コード例 #13
0
        private void InitCustomColors(Dictionary <KnownColors, Color> rgbTable)
        {
            PanelEx panel = this._basePanel as PanelEx;

            if (panel != null)
            {
                rgbTable[KnownColors.BorderColor]                       = panel.CustomColors.BorderColor;
                rgbTable[KnownColors.InnerBorderColor]                  = panel.CustomColors.InnerBorderColor;
                rgbTable[KnownColors.PanelCaptionCloseIcon]             = panel.CustomColors.CaptionCloseIcon;
                rgbTable[KnownColors.PanelCaptionExpandIcon]            = panel.CustomColors.CaptionExpandIcon;
                rgbTable[KnownColors.PanelCaptionGradientBegin]         = panel.CustomColors.CaptionGradientBegin;
                rgbTable[KnownColors.PanelCaptionGradientEnd]           = panel.CustomColors.CaptionGradientEnd;
                rgbTable[KnownColors.PanelCaptionGradientMiddle]        = panel.CustomColors.CaptionGradientMiddle;
                rgbTable[KnownColors.PanelCaptionSelectedGradientBegin] = panel.CustomColors.CaptionSelectedGradientBegin;
                rgbTable[KnownColors.PanelCaptionSelectedGradientEnd]   = panel.CustomColors.CaptionSelectedGradientEnd;
                rgbTable[KnownColors.PanelContentGradientBegin]         = panel.CustomColors.ContentGradientBegin;
                rgbTable[KnownColors.PanelContentGradientEnd]           = panel.CustomColors.ContentGradientEnd;
                rgbTable[KnownColors.PanelCaptionText]                  = panel.CustomColors.CaptionText;
                rgbTable[KnownColors.PanelCollapsedCaptionText]         = panel.CustomColors.CollapsedCaptionText;
            }

            ExpondPanel expondPanel = this._basePanel as ExpondPanel;

            if (expondPanel != null)
            {
                rgbTable[KnownColors.BorderColor]                         = expondPanel.CustomColors.BorderColor;
                rgbTable[KnownColors.InnerBorderColor]                    = expondPanel.CustomColors.InnerBorderColor;
                rgbTable[KnownColors.ExpondPanelBackColor]                = expondPanel.CustomColors.BackColor;
                rgbTable[KnownColors.ExpondPanelCaptionCloseIcon]         = expondPanel.CustomColors.CaptionCloseIcon;
                rgbTable[KnownColors.ExpondPanelCaptionExpandIcon]        = expondPanel.CustomColors.CaptionExpandIcon;
                rgbTable[KnownColors.ExpondPanelCaptionText]              = expondPanel.CustomColors.CaptionText;
                rgbTable[KnownColors.ExpondPanelCaptionGradientBegin]     = expondPanel.CustomColors.CaptionGradientBegin;
                rgbTable[KnownColors.ExpondPanelCaptionGradientEnd]       = expondPanel.CustomColors.CaptionGradientEnd;
                rgbTable[KnownColors.ExpondPanelCaptionGradientMiddle]    = expondPanel.CustomColors.CaptionGradientMiddle;
                rgbTable[KnownColors.ExpondPanelFlatCaptionGradientBegin] = expondPanel.CustomColors.FlatCaptionGradientBegin;
                rgbTable[KnownColors.ExpondPanelFlatCaptionGradientEnd]   = expondPanel.CustomColors.FlatCaptionGradientEnd;
                rgbTable[KnownColors.ExpondPanelPressedCaptionBegin]      = expondPanel.CustomColors.CaptionPressedGradientBegin;
                rgbTable[KnownColors.ExpondPanelPressedCaptionEnd]        = expondPanel.CustomColors.CaptionPressedGradientEnd;
                rgbTable[KnownColors.ExpondPanelPressedCaptionMiddle]     = expondPanel.CustomColors.CaptionPressedGradientMiddle;
                rgbTable[KnownColors.ExpondPanelCheckedCaptionBegin]      = expondPanel.CustomColors.CaptionCheckedGradientBegin;
                rgbTable[KnownColors.ExpondPanelCheckedCaptionEnd]        = expondPanel.CustomColors.CaptionCheckedGradientEnd;
                rgbTable[KnownColors.ExpondPanelCheckedCaptionMiddle]     = expondPanel.CustomColors.CaptionCheckedGradientMiddle;
                rgbTable[KnownColors.ExpondPanelSelectedCaptionBegin]     = expondPanel.CustomColors.CaptionSelectedGradientBegin;
                rgbTable[KnownColors.ExpondPanelSelectedCaptionEnd]       = expondPanel.CustomColors.CaptionSelectedGradientEnd;
                rgbTable[KnownColors.ExpondPanelSelectedCaptionMiddle]    = expondPanel.CustomColors.CaptionSelectedGradientMiddle;
                rgbTable[KnownColors.ExpondPanelSelectedCaptionText]      = expondPanel.CustomColors.CaptionSelectedText;
            }
        }
コード例 #14
0
        protected override void OnControlAdded(System.Windows.Forms.ControlEventArgs e)
        {
            base.OnControlAdded(e);
            ExpondPanel expondPanel = e.Control as ExpondPanel;

            if (expondPanel != null)
            {
                if (expondPanel.Expand == true)
                {
                    foreach (ExpondPanel tmpExpondPanel in this.ExpondPanels)
                    {
                        if (tmpExpondPanel != expondPanel)
                        {
                            tmpExpondPanel.Expand = false;
                            tmpExpondPanel.Height = expondPanel.CaptionHeight;
                        }
                    }
                }
                expondPanel.Parent = this;
                expondPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                                                                           | System.Windows.Forms.AnchorStyles.Right)));
                expondPanel.Left  = this.Padding.Left;
                expondPanel.Width = this.ClientRectangle.Width
                                    - this.Padding.Left
                                    - this.Padding.Right;
                expondPanel.PanelStyle  = this.PanelStyle;
                expondPanel.ColorScheme = this.ColorScheme;
                if (this.PanelColors != null)
                {
                    expondPanel.SetPanelProperties(this.PanelColors);
                }
                expondPanel.ShowBorder         = this.ShowBorder;
                expondPanel.ShowCloseIcon      = this._isShowCloseIcon;
                expondPanel.ShowExpandIcon     = this._isShowExpandIcon;
                expondPanel.CaptionStyle       = this._captionStyle;
                expondPanel.Top                = this.GetTopPosition();
                expondPanel.PanelStyleChanged += new EventHandler <PanelStyleChangeEventArgs>(ExpondPanelPanelStyleChanged);
                expondPanel.ExpandClick       += new EventHandler <EventArgs>(this.ExpondPanelExpandClick);
                expondPanel.CloseClick        += new EventHandler <EventArgs>(this.ExpondPanelCloseClick);
            }
            else
            {
                throw new InvalidOperationException("Can only add ExpondPanel");
            }
        }
コード例 #15
0
 public void Insert(int index, ExpondPanel expondPanel)
 {
     ((IList)this).Insert(index, (object)expondPanel);
 }
コード例 #16
0
 public ExpondPanelCaptionClickBehavior(ExpondPanel expondPanel)
 {
     this.m_expondPanel = expondPanel;
 }
コード例 #17
0
 public bool Contains(ExpondPanel expondPanel)
 {
     return(this._controlCollection.Contains(expondPanel));
 }
コード例 #18
0
 public void Add(ExpondPanel expondPanel)
 {
     this._controlCollection.Add(expondPanel);
     this._expondPanelList.Invalidate();
 }
コード例 #19
0
 public void Remove(ExpondPanel expondPanel)
 {
     this._controlCollection.Remove(expondPanel);
 }
コード例 #20
0
 public int IndexOf(ExpondPanel expondPanel)
 {
     return(this._controlCollection.IndexOf(expondPanel));
 }
コード例 #21
0
        private static void DrawBorders(Graphics graphics, ExpondPanel expondPanel)
        {
            if (expondPanel.ShowBorder == true)
            {
                using (GraphicsPath graphicsPath = new GraphicsPath())
                {
                    using (Pen borderPen = new Pen(expondPanel.PanelColors.BorderColor, StaticResource.BorderThickness))
                    {
                        Rectangle captionRectangle = expondPanel.CaptionRectangle;
                        Rectangle borderRectangle  = captionRectangle;

                        if (expondPanel.Expand == true)
                        {
                            borderRectangle = expondPanel.ClientRectangle;

                            graphics.DrawLine(
                                borderPen,
                                captionRectangle.Left,
                                captionRectangle.Top + captionRectangle.Height - StaticResource.BorderThickness,
                                captionRectangle.Left + captionRectangle.Width,
                                captionRectangle.Top + captionRectangle.Height - StaticResource.BorderThickness);
                        }

                        ExpondPanelList expondPanelList = expondPanel.Parent as ExpondPanelList;
                        if ((expondPanelList != null) && (expondPanelList.Dock == DockStyle.Fill))
                        {
                            PanelEx     panel             = expondPanelList.Parent as PanelEx;
                            ExpondPanel parentExpondPanel = expondPanelList.Parent as ExpondPanel;
                            if (((panel != null) && (panel.Padding == new Padding(0))) ||
                                ((parentExpondPanel != null) && (parentExpondPanel.Padding == new Padding(0))))
                            {
                                if (expondPanel.Top != 0)
                                {
                                    graphicsPath.AddLine(
                                        borderRectangle.Left,
                                        borderRectangle.Top,
                                        borderRectangle.Left + captionRectangle.Width,
                                        borderRectangle.Top);
                                }

                                // Left vertical borderline
                                graphics.DrawLine(borderPen,
                                                  borderRectangle.Left,
                                                  borderRectangle.Top,
                                                  borderRectangle.Left,
                                                  borderRectangle.Top + borderRectangle.Height);

                                // Right vertical borderline
                                graphics.DrawLine(borderPen,
                                                  borderRectangle.Left + borderRectangle.Width - StaticResource.BorderThickness,
                                                  borderRectangle.Top,
                                                  borderRectangle.Left + borderRectangle.Width - StaticResource.BorderThickness,
                                                  borderRectangle.Top + borderRectangle.Height);
                            }
                            else
                            {
                                // Upper horizontal borderline only at the top expondPanel
                                if (expondPanel.Top == 0)
                                {
                                    graphicsPath.AddLine(
                                        borderRectangle.Left,
                                        borderRectangle.Top,
                                        borderRectangle.Left + borderRectangle.Width,
                                        borderRectangle.Top);
                                }

                                // Left vertical borderline
                                graphicsPath.AddLine(
                                    borderRectangle.Left,
                                    borderRectangle.Top,
                                    borderRectangle.Left,
                                    borderRectangle.Top + borderRectangle.Height);

                                //Lower horizontal borderline
                                graphicsPath.AddLine(
                                    borderRectangle.Left,
                                    borderRectangle.Top + borderRectangle.Height - StaticResource.BorderThickness,
                                    borderRectangle.Left + borderRectangle.Width - StaticResource.BorderThickness,
                                    borderRectangle.Top + borderRectangle.Height - StaticResource.BorderThickness);

                                // Right vertical borderline
                                graphicsPath.AddLine(
                                    borderRectangle.Left + borderRectangle.Width - StaticResource.BorderThickness,
                                    borderRectangle.Top,
                                    borderRectangle.Left + borderRectangle.Width - StaticResource.BorderThickness,
                                    borderRectangle.Top + borderRectangle.Height);
                            }
                        }
                        else
                        {
                            // Upper horizontal borderline only at the top expondPanel
                            if (expondPanel.Top == 0)
                            {
                                graphicsPath.AddLine(
                                    borderRectangle.Left,
                                    borderRectangle.Top,
                                    borderRectangle.Left + borderRectangle.Width,
                                    borderRectangle.Top);
                            }

                            // Left vertical borderline
                            graphicsPath.AddLine(
                                borderRectangle.Left,
                                borderRectangle.Top,
                                borderRectangle.Left,
                                borderRectangle.Top + borderRectangle.Height);

                            //Lower horizontal borderline
                            graphicsPath.AddLine(
                                borderRectangle.Left,
                                borderRectangle.Top + borderRectangle.Height - StaticResource.BorderThickness,
                                borderRectangle.Left + borderRectangle.Width - StaticResource.BorderThickness,
                                borderRectangle.Top + borderRectangle.Height - StaticResource.BorderThickness);

                            // Right vertical borderline
                            graphicsPath.AddLine(
                                borderRectangle.Left + borderRectangle.Width - StaticResource.BorderThickness,
                                borderRectangle.Top,
                                borderRectangle.Left + borderRectangle.Width - StaticResource.BorderThickness,
                                borderRectangle.Top + borderRectangle.Height);
                        }
                    }
                    using (Pen borderPen = new Pen(expondPanel.PanelColors.BorderColor, StaticResource.BorderThickness))
                    {
                        graphics.DrawPath(borderPen, graphicsPath);
                    }
                }
            }
        }