示例#1
0
        private static void DrawInnerBorders(Graphics graphics, PanderPanelW PanderPanelW)
        {
            if (PanderPanelW.ShowBorder == true)
            {
                using (GraphicsPath graphicsPath = new GraphicsPath())
                {
                    Rectangle        captionRectangle = PanderPanelW.CaptionRectangle;
                    PanderPanelListW PanderPanelListW = PanderPanelW.Parent as PanderPanelListW;
                    if ((PanderPanelListW != null) && (PanderPanelListW.Dock == DockStyle.Fill))
                    {
                        XiaoCai.WinformUI.Panels.PanelW panel = PanderPanelListW.Parent as XiaoCai.WinformUI.Panels.PanelW;
                        PanderPanelW parentPanderPanelW       = PanderPanelListW.Parent as PanderPanelW;
                        if (((panel != null) && (panel.Padding == new Padding(0))) ||
                            ((parentPanderPanelW != null) && (parentPanderPanelW.Padding == new Padding(0))))
                        {
                            //Left vertical borderline
                            graphicsPath.AddLine(captionRectangle.X, captionRectangle.Y + captionRectangle.Height, captionRectangle.X, captionRectangle.Y + Constants.BorderThickness);
                            if (PanderPanelW.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 (PanderPanelW.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(PanderPanelW.PanelColors.InnerBorderColor))
                    {
                        graphics.DrawPath(borderPen, graphicsPath);
                    }
                }
            }
        }
示例#2
0
        private static void DrawBorders(Graphics graphics, PanderPanelW PanderPanelW)
        {
            if (PanderPanelW.ShowBorder == true)
            {
                using (GraphicsPath graphicsPath = new GraphicsPath())
                {
                    using (Pen borderPen = new Pen(PanderPanelW.PanelColors.BorderColor, Constants.BorderThickness))
                    {
                        Rectangle captionRectangle = PanderPanelW.CaptionRectangle;
                        Rectangle borderRectangle  = captionRectangle;

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

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

                        PanderPanelListW PanderPanelListW = PanderPanelW.Parent as PanderPanelListW;
                        if ((PanderPanelListW != null) && (PanderPanelListW.Dock == DockStyle.Fill))
                        {
                            XiaoCai.WinformUI.Panels.PanelW panel = PanderPanelListW.Parent as XiaoCai.WinformUI.Panels.PanelW;
                            PanderPanelW parentPanderPanelW       = PanderPanelListW.Parent as PanderPanelW;
                            if (((panel != null) && (panel.Padding == new Padding(0))) ||
                                ((parentPanderPanelW != null) && (parentPanderPanelW.Padding == new Padding(0))))
                            {
                                if (PanderPanelW.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 PanderPanelW
                                if (PanderPanelW.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 PanderPanelW
                            if (PanderPanelW.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(PanderPanelW.PanelColors.BorderColor, Constants.BorderThickness))
                    {
                        graphics.DrawPath(borderPen, graphicsPath);
                    }
                }
            }
        }