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); } } } }
private void XPanderPanelExpandClick(object sender, EventArgs e) { XPanderPanel xPanderPanel = sender as XPanderPanel; if (xPanderPanel != null) { Expand(xPanderPanel); } }
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); }
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)); } }
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; } }
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)); }
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; } }
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); }
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); } } } }
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; } } } }
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(); } }
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; }
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); } }
public bool Contains(XPanderPanel xpanderPanel) { return(m_controlCollection.Contains(xpanderPanel)); }
public XPanderPanelCaptionClickBehavior(XPanderPanel xpanderPanel) { m_xpanderPanel = xpanderPanel; }
public void Remove(XPanderPanel xpanderPanel) { m_controlCollection.Remove(xpanderPanel); }
public void Insert(int index, XPanderPanel xpanderPanel) { ((IList)this).Insert(index, (object)xpanderPanel); }
public int IndexOf(XPanderPanel xpanderPanel) { return(m_controlCollection.IndexOf(xpanderPanel)); }
public XPanderPanelCaptionGlyph(BehaviorService behaviorService, XPanderPanel xpanderPanel) : base(new XPanderPanelCaptionClickBehavior(xpanderPanel)) { m_behaviorService = behaviorService; m_xpanderPanel = xpanderPanel; }
public void Add(XPanderPanel xpanderPanel) { m_controlCollection.Add(xpanderPanel); m_xpanderPanelList.Invalidate(); }