/// <summary>
 /// Initializes a new instance of the CaptionGlyph class.
 /// </summary>
 /// <param name="behaviorService"></param>
 /// <param name="xpanderPanel"></param>
 public XAccordionPanelPanelCaptionGlyph(System.Windows.Forms.Design.Behavior.BehaviorService behaviorService, XAccordionPanelPanel xpanderPanel)
     :
     base(new XAccordionPanelPanelCaptionClickBehavior(xpanderPanel))
 {
     this.m_behaviorService = behaviorService;
     this.m_xpanderPanel    = xpanderPanel;
 }
        /// <summary>
        /// Initializes the designer with the specified component.
        /// </summary>
        /// <param name="component">The IComponent to associate with the designer.</param>
        public override void Initialize(IComponent component)
        {
            base.Initialize(component);
            XAccordionPanelPanel xpanderPanel = Control as XAccordionPanelPanel;

            if (xpanderPanel != null)
            {
                this.m_adorner = new System.Windows.Forms.Design.Behavior.Adorner();
                BehaviorService.Adorners.Add(this.m_adorner);
                this.m_adorner.Glyphs.Add(new XAccordionPanelPanelCaptionGlyph(BehaviorService, xpanderPanel));
            }
        }
        private static void DrawInnerBorders(Graphics graphics, XAccordionPanelPanel xpanderPanel)
        {
            if (xpanderPanel.ShowBorder == true)
            {
                using (GraphicsPath graphicsPath = new GraphicsPath())
                {
                    Rectangle captionRectangle = xpanderPanel.CaptionRectangle;
                    XAccordionPanelPanelList xpanderPanelList = xpanderPanel.Parent as XAccordionPanelPanelList;
                    if ((xpanderPanelList != null) && (xpanderPanelList.Dock == DockStyle.Fill))
                    {
                        Com.GainWinSoft.Common.Control.XAccordionPanel.Panel panel = xpanderPanelList.Parent as Com.GainWinSoft.Common.Control.XAccordionPanel.Panel;
                        XAccordionPanelPanel parentXAccordionPanelPanel            = xpanderPanelList.Parent as XAccordionPanelPanel;
                        if (((panel != null) && (panel.Padding == new Padding(0))) ||
                            ((parentXAccordionPanelPanel != null) && (parentXAccordionPanelPanel.Padding == new Padding(0))))
                        {
                            //Left vertical borderline
                            graphicsPath.AddLine(captionRectangle.X, captionRectangle.Y + captionRectangle.Height, captionRectangle.X, captionRectangle.Y + Constants.BorderThickness);
                            if (xpanderPanel.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 + Constants.BorderThickness, captionRectangle.X + captionRectangle.Width, captionRectangle.Y + Constants.BorderThickness);
                            }
                        }
                    }
                    else
                    {
                        //Left vertical borderline
                        graphicsPath.AddLine(captionRectangle.X + Constants.BorderThickness, captionRectangle.Y + captionRectangle.Height, captionRectangle.X + Constants.BorderThickness, captionRectangle.Y);
                        if (xpanderPanel.Top == 0)
                        {
                            //Upper horizontal borderline
                            graphicsPath.AddLine(captionRectangle.X + Constants.BorderThickness, captionRectangle.Y + Constants.BorderThickness, captionRectangle.X + captionRectangle.Width - Constants.BorderThickness, captionRectangle.Y + Constants.BorderThickness);
                        }
                        else
                        {
                            //Upper horizontal borderline
                            graphicsPath.AddLine(captionRectangle.X + Constants.BorderThickness, captionRectangle.Y, captionRectangle.X + captionRectangle.Width - Constants.BorderThickness, captionRectangle.Y);
                        }
                    }

                    using (Pen borderPen = new Pen(xpanderPanel.PanelColors.InnerBorderColor))
                    {
                        graphics.DrawPath(borderPen, graphicsPath);
                    }
                }
            }
        }
Beispiel #4
0
        private void InitCustomColors(Dictionary <KnownColors, Color> rgbTable)
        {
            Panel panel = this.m_basePanel as Panel;

            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;
            }

            XAccordionPanelPanel xpanderPanel = this.m_basePanel as XAccordionPanelPanel;

            if (xpanderPanel != null)
            {
                rgbTable[KnownColors.BorderColor]      = xpanderPanel.CustomColors.BorderColor;
                rgbTable[KnownColors.InnerBorderColor] = xpanderPanel.CustomColors.InnerBorderColor;
                rgbTable[KnownColors.XAccordionPanelPanelBackColor]                = xpanderPanel.CustomColors.BackColor;
                rgbTable[KnownColors.XAccordionPanelPanelCaptionCloseIcon]         = xpanderPanel.CustomColors.CaptionCloseIcon;
                rgbTable[KnownColors.XAccordionPanelPanelCaptionExpandIcon]        = xpanderPanel.CustomColors.CaptionExpandIcon;
                rgbTable[KnownColors.XAccordionPanelPanelCaptionText]              = xpanderPanel.CustomColors.CaptionText;
                rgbTable[KnownColors.XAccordionPanelPanelCaptionGradientBegin]     = xpanderPanel.CustomColors.CaptionGradientBegin;
                rgbTable[KnownColors.XAccordionPanelPanelCaptionGradientEnd]       = xpanderPanel.CustomColors.CaptionGradientEnd;
                rgbTable[KnownColors.XAccordionPanelPanelCaptionGradientMiddle]    = xpanderPanel.CustomColors.CaptionGradientMiddle;
                rgbTable[KnownColors.XAccordionPanelPanelFlatCaptionGradientBegin] = xpanderPanel.CustomColors.FlatCaptionGradientBegin;
                rgbTable[KnownColors.XAccordionPanelPanelFlatCaptionGradientEnd]   = xpanderPanel.CustomColors.FlatCaptionGradientEnd;
                rgbTable[KnownColors.XAccordionPanelPanelPressedCaptionBegin]      = xpanderPanel.CustomColors.CaptionPressedGradientBegin;
                rgbTable[KnownColors.XAccordionPanelPanelPressedCaptionEnd]        = xpanderPanel.CustomColors.CaptionPressedGradientEnd;
                rgbTable[KnownColors.XAccordionPanelPanelPressedCaptionMiddle]     = xpanderPanel.CustomColors.CaptionPressedGradientMiddle;
                rgbTable[KnownColors.XAccordionPanelPanelCheckedCaptionBegin]      = xpanderPanel.CustomColors.CaptionCheckedGradientBegin;
                rgbTable[KnownColors.XAccordionPanelPanelCheckedCaptionEnd]        = xpanderPanel.CustomColors.CaptionCheckedGradientEnd;
                rgbTable[KnownColors.XAccordionPanelPanelCheckedCaptionMiddle]     = xpanderPanel.CustomColors.CaptionCheckedGradientMiddle;
                rgbTable[KnownColors.XAccordionPanelPanelSelectedCaptionBegin]     = xpanderPanel.CustomColors.CaptionSelectedGradientBegin;
                rgbTable[KnownColors.XAccordionPanelPanelSelectedCaptionEnd]       = xpanderPanel.CustomColors.CaptionSelectedGradientEnd;
                rgbTable[KnownColors.XAccordionPanelPanelSelectedCaptionMiddle]    = xpanderPanel.CustomColors.CaptionSelectedGradientMiddle;
                rgbTable[KnownColors.XAccordionPanelPanelSelectedCaptionText]      = xpanderPanel.CustomColors.CaptionSelectedText;
            }
        }
 /// <summary>
 /// Initializes a new instance of the Behavior class.
 /// </summary>
 /// <param name="xpanderPanel">XAccordionPanelPanel for this behaviour</param>
 public XAccordionPanelPanelCaptionClickBehavior(XAccordionPanelPanel xpanderPanel)
 {
     this.m_xpanderPanel = xpanderPanel;
 }
        private static void DrawBorders(Graphics graphics, XAccordionPanelPanel xpanderPanel)
        {
            if (xpanderPanel.ShowBorder == true)
            {
                using (GraphicsPath graphicsPath = new GraphicsPath())
                {
                    using (Pen borderPen = new Pen(xpanderPanel.PanelColors.BorderColor, Constants.BorderThickness))
                    {
                        Rectangle captionRectangle = xpanderPanel.CaptionRectangle;
                        Rectangle borderRectangle  = captionRectangle;

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

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

                        XAccordionPanelPanelList xpanderPanelList = xpanderPanel.Parent as XAccordionPanelPanelList;
                        if ((xpanderPanelList != null) && (xpanderPanelList.Dock == DockStyle.Fill))
                        {
                            Com.GainWinSoft.Common.Control.XAccordionPanel.Panel panel = xpanderPanelList.Parent as Com.GainWinSoft.Common.Control.XAccordionPanel.Panel;
                            XAccordionPanelPanel parentXAccordionPanelPanel            = xpanderPanelList.Parent as XAccordionPanelPanel;
                            if (((panel != null) && (panel.Padding == new Padding(0))) ||
                                ((parentXAccordionPanelPanel != null) && (parentXAccordionPanelPanel.Padding == new Padding(0))))
                            {
                                if (xpanderPanel.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 - Constants.BorderThickness,
                                                  borderRectangle.Top,
                                                  borderRectangle.Left + borderRectangle.Width - Constants.BorderThickness,
                                                  borderRectangle.Top + borderRectangle.Height);
                            }
                            else
                            {
                                // Upper horizontal borderline only at the top xpanderPanel
                                if (xpanderPanel.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 - Constants.BorderThickness,
                                    borderRectangle.Left + borderRectangle.Width - Constants.BorderThickness,
                                    borderRectangle.Top + borderRectangle.Height - Constants.BorderThickness);

                                // Right vertical borderline
                                graphicsPath.AddLine(
                                    borderRectangle.Left + borderRectangle.Width - Constants.BorderThickness,
                                    borderRectangle.Top,
                                    borderRectangle.Left + borderRectangle.Width - Constants.BorderThickness,
                                    borderRectangle.Top + borderRectangle.Height);
                            }
                        }
                        else
                        {
                            // Upper horizontal borderline only at the top xpanderPanel
                            if (xpanderPanel.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 - Constants.BorderThickness,
                                borderRectangle.Left + borderRectangle.Width - Constants.BorderThickness,
                                borderRectangle.Top + borderRectangle.Height - Constants.BorderThickness);

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