private void PaintBorders(Graphics hDCGraphics)
        {
            Rectangle rectangle1 = new Rectangle(0, this.ClientMargin.Top, this.ClientMargin.Left, this.Form.Height - this.ClientMargin.Top);
            Rectangle rectangle2 = new Rectangle(this.Form.Width - this.ClientMargin.Right, this.ClientMargin.Top, this.ClientMargin.Right, this.Form.Height - this.ClientMargin.Top);
            Rectangle rectangle3 = new Rectangle(this.ClientMargin.Left, this.Form.Height - this.ClientMargin.Bottom, this.Form.Width - (this.ClientMargin.Left + this.ClientMargin.Right), this.ClientMargin.Bottom);

            if (rectangle1.Width > 0 && rectangle1.Height > 0)
            {
                Bitmap bitmap = new Bitmap(rectangle1.Width, rectangle1.Height);
                using (Graphics graphics = Graphics.FromImage((Image)bitmap))
                {
                    RadGdiGraphics radGdiGraphics = new RadGdiGraphics(graphics);
                    radGdiGraphics.TranslateTransform(-rectangle1.X, -rectangle1.Y);
                    radGdiGraphics.FillRectangle(rectangle1, this.Form.RootElement.BackColor);
                    this.PaintElement((IGraphics)radGdiGraphics, rectangle1, (VisualElement)this.Form.RootElement);
                }
                hDCGraphics.DrawImage((Image)bitmap, rectangle1);
                bitmap.Dispose();
            }
            if (rectangle2.Width > 0 && rectangle2.Height > 0)
            {
                Bitmap bitmap = new Bitmap(rectangle2.Width, rectangle2.Height);
                using (Graphics graphics = Graphics.FromImage((Image)bitmap))
                {
                    RadGdiGraphics radGdiGraphics = new RadGdiGraphics(graphics);
                    radGdiGraphics.TranslateTransform(-rectangle2.X, -rectangle2.Y);
                    radGdiGraphics.FillRectangle(rectangle2, this.Form.RootElement.BackColor);
                    this.PaintElement((IGraphics)radGdiGraphics, rectangle2, (VisualElement)this.Form.RootElement);
                }
                hDCGraphics.DrawImage((Image)bitmap, rectangle2);
                bitmap.Dispose();
            }
            if (rectangle3.Width <= 0 || rectangle3.Height <= 0)
            {
                return;
            }
            Bitmap bitmap1 = new Bitmap(rectangle3.Width, rectangle3.Height);

            using (Graphics graphics = Graphics.FromImage((Image)bitmap1))
            {
                RadGdiGraphics radGdiGraphics = new RadGdiGraphics(graphics);
                radGdiGraphics.TranslateTransform(-rectangle3.X, -rectangle3.Y);
                radGdiGraphics.FillRectangle(rectangle3, this.Form.RootElement.BackColor);
                this.PaintElement((IGraphics)radGdiGraphics, rectangle3, (VisualElement)this.Form.RootElement);
            }
            hDCGraphics.DrawImage((Image)bitmap1, rectangle3);
            bitmap1.Dispose();
        }
Exemple #2
0
        private void PaintBorders(Graphics hDCGraphics)
        {
            Rectangle leftBorderRect = new Rectangle(
                0,
                this.ClientMargin.Top,
                this.ClientMargin.Left,
                this.Form.Height - this.ClientMargin.Top
                );

            Rectangle rightBorderRect = new Rectangle(
                this.Form.Width - (this.ClientMargin.Right),
                this.ClientMargin.Top,
                this.ClientMargin.Right,
                this.Form.Height - this.ClientMargin.Top);

            Rectangle bottomBorderRect = new Rectangle(
                this.ClientMargin.Left,
                this.Form.Height - (this.ClientMargin.Bottom),
                this.Form.Width - (this.ClientMargin.Left + this.ClientMargin.Right),
                this.ClientMargin.Bottom);


            if (leftBorderRect.Width > 0 && leftBorderRect.Height > 0)
            {
                Bitmap leftBorderOffscreen = new Bitmap(leftBorderRect.Width, leftBorderRect.Height);

                using (Graphics g = Graphics.FromImage(leftBorderOffscreen))
                {
                    RadGdiGraphics radGraphics = new RadGdiGraphics(g);
                    radGraphics.TranslateTransform(-leftBorderRect.X, -leftBorderRect.Y);
                    radGraphics.FillRectangle(leftBorderRect, this.Form.RootElement.BackColor);
                    PaintElement(radGraphics, leftBorderRect, this.Form.RootElement);
                }


                hDCGraphics.DrawImage(leftBorderOffscreen, leftBorderRect);
                leftBorderOffscreen.Dispose();
            }

            if (rightBorderRect.Width > 0 && rightBorderRect.Height > 0)
            {
                Bitmap rightBorderOffscreen = new Bitmap(rightBorderRect.Width, rightBorderRect.Height);

                using (Graphics g = Graphics.FromImage(rightBorderOffscreen))
                {
                    RadGdiGraphics radGraphics = new RadGdiGraphics(g);
                    radGraphics.TranslateTransform(-rightBorderRect.X, -rightBorderRect.Y);
                    radGraphics.FillRectangle(rightBorderRect, this.Form.RootElement.BackColor);
                    PaintElement(radGraphics, rightBorderRect, this.Form.RootElement);
                }

                hDCGraphics.DrawImage(rightBorderOffscreen, rightBorderRect);
                rightBorderOffscreen.Dispose();
            }


            if (bottomBorderRect.Width > 0 && bottomBorderRect.Height > 0)
            {
                Bitmap bottomBorderOffscreen = new Bitmap(bottomBorderRect.Width, bottomBorderRect.Height);

                using (Graphics g = Graphics.FromImage(bottomBorderOffscreen))
                {
                    RadGdiGraphics radGraphics = new RadGdiGraphics(g);
                    radGraphics.TranslateTransform(-bottomBorderRect.X, -bottomBorderRect.Y);
                    radGraphics.FillRectangle(bottomBorderRect, this.Form.RootElement.BackColor);
                    PaintElement(radGraphics, bottomBorderRect, this.Form.RootElement);
                }

                hDCGraphics.DrawImage(bottomBorderOffscreen, bottomBorderRect);
                bottomBorderOffscreen.Dispose();
            }
        }