示例#1
0
            private NBorderWall CreateOpenedBorderWall()
            {
                NRectangle outer = GetBorderEdge();
                NRectangle inner = GetContentEdge();

                NBorderWall wall = new NBorderWall(false);

                double leftSide   = inner.X - outer.X;
                double topSide    = inner.Y - outer.Y;
                double rightSide  = outer.Right - inner.Right;
                double bottomSide = outer.Bottom - inner.Bottom;

                double topClipStart = inner.X + inner.Width / 3;
                double topClipEnd   = inner.Right - inner.Width / 3;

                wall.AddTopSide(new NRectangle(topClipEnd, outer.Y, inner.Right - topClipEnd, topSide));
                wall.AddTopRightCorner(new NRectangle(inner.Right, outer.Y, rightSide, topSide));
                wall.AddRightSide(new NRectangle(inner.Right, inner.Y, rightSide, inner.Height));
                wall.AddRightBottomCorner(new NRectangle(inner.Right, inner.Bottom, rightSide, bottomSide));
                wall.AddBottomSide(new NRectangle(inner.X, inner.Bottom, inner.Width, bottomSide));
                wall.AddBottomLeftCorner(new NRectangle(outer.X, inner.Bottom, leftSide, bottomSide));
                wall.AddLeftSide(new NRectangle(outer.X, inner.Y, leftSide, inner.Height));
                wall.AddLeftTopCorner(new NRectangle(outer.X, outer.Y, leftSide, topSide));
                wall.AddTopSide(new NRectangle(inner.X, outer.Y, topClipStart - inner.X, topSide));

                return(wall);
            }
示例#2
0
            private NBorderWall CreateCrossBorderWall()
            {
                NRectangle r0 = GetContentEdge();

                NMargins bt = BorderThickness;

                bt.Left   = Math.Min(bt.Left, r0.Width / 6);
                bt.Right  = Math.Min(bt.Right, r0.Width / 6);
                bt.Top    = Math.Min(bt.Top, r0.Height / 6);
                bt.Bottom = Math.Min(bt.Bottom, r0.Height / 6);

                NRectangle r1 = bt.GetInnerRect(r0);

                NRectangle r2 = NRectangle.FromLTRB(
                    r1.X + r1.Width / 3 - (bt.Left / 2),
                    r1.Y + r1.Height / 3 - (bt.Top / 2),
                    r1.Right - r1.Width / 3 + (bt.Right / 2),
                    r1.Bottom - r1.Height / 3 + (bt.Bottom / 2));

                NRectangle r3 = bt.GetInnerRect(r2);

                double x0 = r0.X;
                double x1 = r1.X;
                double x2 = r2.X;
                double x3 = r3.X;
                double x4 = r3.Right;
                double x5 = r2.Right;
                double x6 = r1.Right;
                double x7 = r0.Right;

                double y0 = r0.Y;
                double y1 = r1.Y;
                double y2 = r2.Y;
                double y3 = r3.Y;
                double y4 = r3.Bottom;
                double y5 = r2.Bottom;
                double y6 = r1.Bottom;
                double y7 = r0.Bottom;

                NBorderWall wall = new NBorderWall(true);

                wall.AddLeftTopCorner(new NRectangle(x2, y0, bt.Left, bt.Top));
                wall.AddTopSide(new NRectangle(x3, y0, x4 - x3, bt.Top));
                wall.AddTopRightCorner(new NRectangle(x4, y0, bt.Right, bt.Top));
                wall.AddRightSide(new NRectangle(x4, y1, bt.Right, y2 - y1));
                wall.AddRightTopCorner(new NRectangle(x4, y2, bt.Right, bt.Top));
                wall.AddTopSide(new NRectangle(x5, y2, x6 - x5, bt.Top));
                wall.AddTopRightCorner(new NRectangle(x6, y2, bt.Right, bt.Top));
                wall.AddRightSide(new NRectangle(x6, y3, bt.Right, y4 - y3));
                wall.AddRightBottomCorner(new NRectangle(x6, y4, bt.Right, bt.Bottom));
                wall.AddBottomSide(new NRectangle(x5, y4, x6 - x5, bt.Bottom));
                wall.AddBottomRightCorner(new NRectangle(x4, y4, bt.Right, bt.Bottom));
                wall.AddRightSide(new NRectangle(x4, y5, bt.Right, y6 - y5));
                wall.AddRightBottomCorner(new NRectangle(x4, y6, bt.Right, bt.Bottom));
                wall.AddBottomSide(new NRectangle(x3, y6, x4 - x3, bt.Bottom));
                wall.AddBottomLeftCorner(new NRectangle(x2, y6, bt.Left, bt.Bottom));
                wall.AddLeftSide(new NRectangle(x2, y5, bt.Left, y6 - y5));
                wall.AddLeftBottomCorner(new NRectangle(x2, y4, bt.Left, bt.Bottom));
                wall.AddBottomSide(new NRectangle(x1, y4, x2 - x1, bt.Bottom));
                wall.AddBottomLeftCorner(new NRectangle(x0, y4, bt.Left, bt.Bottom));
                wall.AddLeftSide(new NRectangle(x0, y3, bt.Left, y4 - y3));
                wall.AddLeftTopCorner(new NRectangle(x0, y2, bt.Left, bt.Top));
                wall.AddTopSide(new NRectangle(x1, y2, x2 - x1, bt.Top));
                wall.AddTopLeftCorner(new NRectangle(x2, y2, bt.Left, bt.Top));
                wall.AddLeftSide(new NRectangle(x2, y1, bt.Left, y2 - y1));

                return(wall);
            }