Exemplo n.º 1
0
 private static void DrawBorders(Graphics graphics, XPanderPanel xpanderPanel)
 {
     if (xpanderPanel.ShowBorder)
     {
         using (GraphicsPath graphicsPath = new GraphicsPath())
         {
             using (Pen pen = new Pen(xpanderPanel.PanelColors.BorderColor, 1f))
             {
                 Rectangle captionRectangle = xpanderPanel.CaptionRectangle;
                 Rectangle rectangle        = captionRectangle;
                 if (xpanderPanel.Expand)
                 {
                     rectangle = xpanderPanel.ClientRectangle;
                     graphics.DrawLine(pen, captionRectangle.Left, captionRectangle.Top + captionRectangle.Height - 1, captionRectangle.Left + captionRectangle.Width, captionRectangle.Top + captionRectangle.Height - 1);
                 }
                 XPanderPanelList xPanderPanelList = xpanderPanel.Parent as XPanderPanelList;
                 if (xPanderPanelList != null && xPanderPanelList.Dock == DockStyle.Fill)
                 {
                     TXPanelFrame tXPanelFrame = xPanderPanelList.Parent as TXPanelFrame;
                     XPanderPanel xPanderPanel = xPanderPanelList.Parent as XPanderPanel;
                     if ((tXPanelFrame != null && tXPanelFrame.Padding == new Padding(0)) || (xPanderPanel != null && xPanderPanel.Padding == new Padding(0)))
                     {
                         if (xpanderPanel.Top != 0)
                         {
                             graphicsPath.AddLine(rectangle.Left, rectangle.Top, rectangle.Left + captionRectangle.Width, rectangle.Top);
                         }
                         graphics.DrawLine(pen, rectangle.Left, rectangle.Top, rectangle.Left, rectangle.Top + rectangle.Height);
                         graphics.DrawLine(pen, rectangle.Left + rectangle.Width - 1, rectangle.Top, rectangle.Left + rectangle.Width - 1, rectangle.Top + rectangle.Height);
                     }
                     else
                     {
                         if (xpanderPanel.Top == 0)
                         {
                             graphicsPath.AddLine(rectangle.Left, rectangle.Top, rectangle.Left + rectangle.Width, rectangle.Top);
                         }
                         graphicsPath.AddLine(rectangle.Left, rectangle.Top, rectangle.Left, rectangle.Top + rectangle.Height);
                         graphicsPath.AddLine(rectangle.Left, rectangle.Top + rectangle.Height - 1, rectangle.Left + rectangle.Width - 1, rectangle.Top + rectangle.Height - 1);
                         graphicsPath.AddLine(rectangle.Left + rectangle.Width - 1, rectangle.Top, rectangle.Left + rectangle.Width - 1, rectangle.Top + rectangle.Height);
                     }
                 }
                 else
                 {
                     if (xpanderPanel.Top == 0)
                     {
                         graphicsPath.AddLine(rectangle.Left, rectangle.Top, rectangle.Left + rectangle.Width, rectangle.Top);
                     }
                     graphicsPath.AddLine(rectangle.Left, rectangle.Top, rectangle.Left, rectangle.Top + rectangle.Height);
                     graphicsPath.AddLine(rectangle.Left, rectangle.Top + rectangle.Height - 1, rectangle.Left + rectangle.Width - 1, rectangle.Top + rectangle.Height - 1);
                     graphicsPath.AddLine(rectangle.Left + rectangle.Width - 1, rectangle.Top, rectangle.Left + rectangle.Width - 1, rectangle.Top + rectangle.Height);
                 }
             }
             using (Pen pen = new Pen(xpanderPanel.PanelColors.BorderColor, 1f))
             {
                 graphics.DrawPath(pen, graphicsPath);
             }
         }
     }
 }
Exemplo n.º 2
0
        private void XPanderPanelExpandClick(object sender, EventArgs e)
        {
            XPanderPanel xPanderPanel = sender as XPanderPanel;

            if (xPanderPanel != null)
            {
                Expand(xPanderPanel);
            }
        }
Exemplo n.º 3
0
        private void XPanderPanelCloseClick(object sender, EventArgs e)
        {
            XPanderPanel xPanderPanel = sender as XPanderPanel;

            if (xPanderPanel != null)
            {
                base.Controls.Remove(xPanderPanel);
            }
        }
        protected override object CreateInstance(Type ItemType)
        {
            XPanderPanel xPanderPanel = (XPanderPanel)base.CreateInstance(ItemType);

            if (base.Context.Instance != null)
            {
                xPanderPanel.Expand = true;
            }
            return(xPanderPanel);
        }
Exemplo n.º 5
0
        public override void Initialize(IComponent component)
        {
            base.Initialize(component);
            XPanderPanel xPanderPanel = Control as XPanderPanel;

            if (xPanderPanel != null)
            {
                m_adorner = new Adorner();
                base.BehaviorService.Adorners.Add(m_adorner);
                m_adorner.Glyphs.Add(new XPanderPanelCaptionGlyph(base.BehaviorService, xPanderPanel));
            }
        }
Exemplo n.º 6
0
        protected override void OnControlRemoved(ControlEventArgs e)
        {
            base.OnControlRemoved(e);
            XPanderPanel xPanderPanel = e.Control as XPanderPanel;

            if (xPanderPanel != null)
            {
                xPanderPanel.PanelStyleChanged -= XpanderPanelPanelStyleChanged;
                xPanderPanel.ExpandClick       -= XPanderPanelExpandClick;
                xPanderPanel.CloseClick        -= XPanderPanelCloseClick;
            }
        }
Exemplo n.º 7
0
        int IList.Add(object value)
        {
            XPanderPanel xPanderPanel = value as XPanderPanel;

            if (xPanderPanel == null)
            {
                throw new ArgumentException(string.Format(CultureInfo.CurrentUICulture, Resources.IDS_ArgumentException, new object[1]
                {
                    typeof(XPanderPanel).Name
                }));
            }
            Add(xPanderPanel);
            return(IndexOf(xPanderPanel));
        }
Exemplo n.º 8
0
        private void InitCustomColors(Dictionary <KnownColors, Color> rgbTable)
        {
            TXPanelFrame tXPanelFrame = m_basePanel as TXPanelFrame;

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

            if (xPanderPanel != null)
            {
                rgbTable[KnownColors.BorderColor]                          = xPanderPanel.CustomColors.BorderColor;
                rgbTable[KnownColors.InnerBorderColor]                     = xPanderPanel.CustomColors.InnerBorderColor;
                rgbTable[KnownColors.XPanderPanelBackColor]                = xPanderPanel.CustomColors.BackColor;
                rgbTable[KnownColors.XPanderPanelCaptionCloseIcon]         = xPanderPanel.CustomColors.CaptionCloseIcon;
                rgbTable[KnownColors.XPanderPanelCaptionExpandIcon]        = xPanderPanel.CustomColors.CaptionExpandIcon;
                rgbTable[KnownColors.XPanderPanelCaptionText]              = xPanderPanel.CustomColors.CaptionText;
                rgbTable[KnownColors.XPanderPanelCaptionGradientBegin]     = xPanderPanel.CustomColors.CaptionGradientBegin;
                rgbTable[KnownColors.XPanderPanelCaptionGradientEnd]       = xPanderPanel.CustomColors.CaptionGradientEnd;
                rgbTable[KnownColors.XPanderPanelCaptionGradientMiddle]    = xPanderPanel.CustomColors.CaptionGradientMiddle;
                rgbTable[KnownColors.XPanderPanelFlatCaptionGradientBegin] = xPanderPanel.CustomColors.FlatCaptionGradientBegin;
                rgbTable[KnownColors.XPanderPanelFlatCaptionGradientEnd]   = xPanderPanel.CustomColors.FlatCaptionGradientEnd;
                rgbTable[KnownColors.XPanderPanelPressedCaptionBegin]      = xPanderPanel.CustomColors.CaptionPressedGradientBegin;
                rgbTable[KnownColors.XPanderPanelPressedCaptionEnd]        = xPanderPanel.CustomColors.CaptionPressedGradientEnd;
                rgbTable[KnownColors.XPanderPanelPressedCaptionMiddle]     = xPanderPanel.CustomColors.CaptionPressedGradientMiddle;
                rgbTable[KnownColors.XPanderPanelCheckedCaptionBegin]      = xPanderPanel.CustomColors.CaptionCheckedGradientBegin;
                rgbTable[KnownColors.XPanderPanelCheckedCaptionEnd]        = xPanderPanel.CustomColors.CaptionCheckedGradientEnd;
                rgbTable[KnownColors.XPanderPanelCheckedCaptionMiddle]     = xPanderPanel.CustomColors.CaptionCheckedGradientMiddle;
                rgbTable[KnownColors.XPanderPanelSelectedCaptionBegin]     = xPanderPanel.CustomColors.CaptionSelectedGradientBegin;
                rgbTable[KnownColors.XPanderPanelSelectedCaptionEnd]       = xPanderPanel.CustomColors.CaptionSelectedGradientEnd;
                rgbTable[KnownColors.XPanderPanelSelectedCaptionMiddle]    = xPanderPanel.CustomColors.CaptionSelectedGradientMiddle;
                rgbTable[KnownColors.XPanderPanelSelectedCaptionText]      = xPanderPanel.CustomColors.CaptionSelectedText;
            }
        }
Exemplo n.º 9
0
        private int GetTopPosition()
        {
            int         num        = base.Padding.Top;
            int         num2       = 0;
            IEnumerator enumerator = XPanderPanels.GetEnumerator();

            while (enumerator.MoveNext())
            {
                XPanderPanel xPanderPanel = (XPanderPanel)enumerator.Current;
                if (xPanderPanel.Visible)
                {
                    num  = ((num2 != base.Padding.Top) ? num2 : base.Padding.Top);
                    num2 = num + xPanderPanel.Height;
                }
            }
            return(num);
        }
Exemplo n.º 10
0
 private static void DrawInnerBorders(Graphics graphics, XPanderPanel xpanderPanel)
 {
     if (xpanderPanel.ShowBorder)
     {
         using (GraphicsPath graphicsPath = new GraphicsPath())
         {
             Rectangle        captionRectangle = xpanderPanel.CaptionRectangle;
             XPanderPanelList xPanderPanelList = xpanderPanel.Parent as XPanderPanelList;
             if (xPanderPanelList != null && xPanderPanelList.Dock == DockStyle.Fill)
             {
                 TXPanelFrame tXPanelFrame = xPanderPanelList.Parent as TXPanelFrame;
                 XPanderPanel xPanderPanel = xPanderPanelList.Parent as XPanderPanel;
                 if ((tXPanelFrame != null && tXPanelFrame.Padding == new Padding(0)) || (xPanderPanel != null && xPanderPanel.Padding == new Padding(0)))
                 {
                     graphicsPath.AddLine(captionRectangle.X, captionRectangle.Y + captionRectangle.Height, captionRectangle.X, captionRectangle.Y + 1);
                     if (xpanderPanel.Top == 0)
                     {
                         graphicsPath.AddLine(captionRectangle.X, captionRectangle.Y, captionRectangle.X + captionRectangle.Width, captionRectangle.Y);
                     }
                     else
                     {
                         graphicsPath.AddLine(captionRectangle.X, captionRectangle.Y + 1, captionRectangle.X + captionRectangle.Width, captionRectangle.Y + 1);
                     }
                 }
             }
             else
             {
                 graphicsPath.AddLine(captionRectangle.X + 1, captionRectangle.Y + captionRectangle.Height, captionRectangle.X + 1, captionRectangle.Y);
                 if (xpanderPanel.Top == 0)
                 {
                     graphicsPath.AddLine(captionRectangle.X + 1, captionRectangle.Y + 1, captionRectangle.X + captionRectangle.Width - 1, captionRectangle.Y + 1);
                 }
                 else
                 {
                     graphicsPath.AddLine(captionRectangle.X + 1, captionRectangle.Y, captionRectangle.X + captionRectangle.Width - 1, captionRectangle.Y);
                 }
             }
             using (Pen pen = new Pen(xpanderPanel.PanelColors.InnerBorderColor))
             {
                 graphics.DrawPath(pen, graphicsPath);
             }
         }
     }
 }
Exemplo n.º 11
0
 private void CalculatePanelHeights()
 {
     if (base.Parent != null)
     {
         int num = base.Parent.Padding.Top;
         foreach (Control control2 in base.Parent.Controls)
         {
             XPanderPanel xPanderPanel = control2 as XPanderPanel;
             if (xPanderPanel != null && xPanderPanel.Visible)
             {
                 num += xPanderPanel.CaptionHeight;
             }
         }
         num += base.Parent.Padding.Bottom;
         foreach (Control control3 in base.Parent.Controls)
         {
             XPanderPanel xPanderPanel = control3 as XPanderPanel;
             if (xPanderPanel != null)
             {
                 if (xPanderPanel.Expand)
                 {
                     xPanderPanel.Height = base.Parent.Height + xPanderPanel.CaptionHeight - num;
                 }
                 else
                 {
                     xPanderPanel.Height = xPanderPanel.CaptionHeight;
                 }
             }
         }
         int num2 = base.Parent.Padding.Top;
         foreach (Control control4 in base.Parent.Controls)
         {
             XPanderPanel xPanderPanel = control4 as XPanderPanel;
             if (xPanderPanel != null && xPanderPanel.Visible)
             {
                 xPanderPanel.Top = num2;
                 num2            += xPanderPanel.Height;
             }
         }
     }
 }
Exemplo n.º 12
0
 protected override void OnVisibleChanged(EventArgs e)
 {
     base.OnVisibleChanged(e);
     if (!base.DesignMode)
     {
         if (!base.Visible && Expand)
         {
             Expand = false;
             foreach (Control control in base.Parent.Controls)
             {
                 XPanderPanel xPanderPanel = control as XPanderPanel;
                 if (xPanderPanel != null && xPanderPanel.Visible)
                 {
                     xPanderPanel.Expand = true;
                     return;
                 }
             }
         }
         CalculatePanelHeights();
     }
 }
Exemplo n.º 13
0
        protected override void OnControlAdded(ControlEventArgs e)
        {
            base.OnControlAdded(e);
            XPanderPanel xPanderPanel = e.Control as XPanderPanel;

            if (xPanderPanel == null)
            {
                throw new InvalidOperationException("Can only add CIT.Client.XPanderPanel");
            }
            if (xPanderPanel.Expand)
            {
                foreach (XPanderPanel xPanderPanel2 in XPanderPanels)
                {
                    if (xPanderPanel2 != xPanderPanel)
                    {
                        xPanderPanel2.Expand = false;
                        xPanderPanel2.Height = xPanderPanel.CaptionHeight;
                    }
                }
            }
            xPanderPanel.Parent      = this;
            xPanderPanel.Anchor      = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
            xPanderPanel.Left        = base.Padding.Left;
            xPanderPanel.Width       = base.ClientRectangle.Width - base.Padding.Left - base.Padding.Right;
            xPanderPanel.PanelStyle  = PanelStyle;
            xPanderPanel.ColorScheme = ColorScheme;
            if (PanelColors != null)
            {
                xPanderPanel.SetPanelProperties(PanelColors);
            }
            xPanderPanel.ShowBorder         = ShowBorder;
            xPanderPanel.ShowCloseIcon      = m_bShowCloseIcon;
            xPanderPanel.ShowExpandIcon     = m_bShowExpandIcon;
            xPanderPanel.CaptionStyle       = m_captionStyle;
            xPanderPanel.Top                = GetTopPosition();
            xPanderPanel.PanelStyleChanged += XpanderPanelPanelStyleChanged;
            xPanderPanel.ExpandClick       += XPanderPanelExpandClick;
            xPanderPanel.CloseClick        += XPanderPanelCloseClick;
        }
Exemplo n.º 14
0
        public void Expand(BasePanel panel)
        {
            if (panel == null)
            {
                throw new ArgumentNullException("panel", string.Format(CultureInfo.InvariantCulture, Resources.IDS_ArgumentException, new object[1]
                {
                    "panel"
                }));
            }
            XPanderPanel xPanderPanel = panel as XPanderPanel;

            if (xPanderPanel != null)
            {
                foreach (XPanderPanel xpanderPanel in m_xpanderPanels)
                {
                    if (!xpanderPanel.Equals(xPanderPanel))
                    {
                        xpanderPanel.Expand = false;
                    }
                }
                TypeDescriptor.GetProperties(xPanderPanel)["Expand"]?.SetValue(xPanderPanel, true);
            }
        }
Exemplo n.º 15
0
 public bool Contains(XPanderPanel xpanderPanel)
 {
     return(m_controlCollection.Contains(xpanderPanel));
 }
Exemplo n.º 16
0
 public XPanderPanelCaptionClickBehavior(XPanderPanel xpanderPanel)
 {
     m_xpanderPanel = xpanderPanel;
 }
Exemplo n.º 17
0
 public void Remove(XPanderPanel xpanderPanel)
 {
     m_controlCollection.Remove(xpanderPanel);
 }
Exemplo n.º 18
0
 public void Insert(int index, XPanderPanel xpanderPanel)
 {
     ((IList)this).Insert(index, (object)xpanderPanel);
 }
Exemplo n.º 19
0
 public int IndexOf(XPanderPanel xpanderPanel)
 {
     return(m_controlCollection.IndexOf(xpanderPanel));
 }
Exemplo n.º 20
0
 public XPanderPanelCaptionGlyph(BehaviorService behaviorService, XPanderPanel xpanderPanel)
     : base(new XPanderPanelCaptionClickBehavior(xpanderPanel))
 {
     m_behaviorService = behaviorService;
     m_xpanderPanel    = xpanderPanel;
 }
Exemplo n.º 21
0
 public void Add(XPanderPanel xpanderPanel)
 {
     m_controlCollection.Add(xpanderPanel);
     m_xpanderPanelList.Invalidate();
 }