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