Example #1
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            Graphics       graphics       = e.Graphics;
            Padding        ncMargin       = this.parentPanel.NCMargin;
            RadGdiGraphics radGdiGraphics = new RadGdiGraphics(graphics);

            radGdiGraphics.TranslateTransform(-ncMargin.Left, -ncMargin.Top);
            this.parentPanel.RootElement.Paint((IGraphics)radGdiGraphics, e.ClipRectangle, true);
            radGdiGraphics.TranslateTransform(ncMargin.Left, ncMargin.Top);
        }
        private Bitmap PaintRightNCArea(Padding ncMetrics)
        {
            Size  thisSize       = this.DesiredSize.ToSize();
            int   thisWidth      = thisSize.Width;
            int   thisHeight     = thisSize.Height;
            SizeF scaleSize      = this.ScaleTransform;
            float angleTransform = this.AngleTransform;

            int bitmapWidth  = ncMetrics.Right;
            int bitmapHeight = thisHeight - ncMetrics.Vertical;

            if (bitmapWidth <= 0 || bitmapHeight <= 0)
            {
                return(null);
            }

            Bitmap rightBitmap = new Bitmap(ncMetrics.Right, thisHeight - ncMetrics.Vertical);

            Graphics rightGraphics = Graphics.FromImage(rightBitmap);

            using (rightGraphics)
            {
                RadGdiGraphics radGraphics = new RadGdiGraphics(rightGraphics);
                radGraphics.TranslateTransform(-(thisWidth - ncMetrics.Right), -ncMetrics.Top);
                this.BorderPrimitiveImpl.PaintBorder(radGraphics, angleTransform, scaleSize);
            }
            return(rightBitmap);
        }
Example #3
0
        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();
        }
Example #4
0
        private void radButton1_Click(object sender, EventArgs e)
        {
            Bitmap         bitmap = new Bitmap((int)this.radMap1.MapElement.ViewportInPixels.Size.Width, (int)this.radMap1.MapElement.ViewportInPixels.Height);
            Graphics       g      = Graphics.FromImage(bitmap);
            RadGdiGraphics gg     = new RadGdiGraphics(g);

            foreach (MapVisualElement element in this.radMap1.MapElement.Providers[0].GetContent(this.radMap1.MapElement))
            {
                element.Paint(gg, this.radMap1.MapElement);
            }

            object state = gg.SaveState();

            gg.TranslateTransform(-this.radMap1.MapElement.ViewportInPixels.X, -this.radMap1.MapElement.ViewportInPixels.Y);
            this.radMap1.MapElement.Layers["PinsLayer"].Paint(gg, this.radMap1.MapElement);

            gg.RestoreState(state);
            bitmap.Save(@"..\..\test.png", ImageFormat.Png);
        }
        private Bitmap PaintBottomNCArea(Padding ncMetrics)
        {
            Size  thisSize       = this.DesiredSize.ToSize();
            int   thisWidth      = thisSize.Width;
            int   thisHeight     = thisSize.Height;
            SizeF scaleSize      = this.ScaleTransform;
            float angleTransform = this.AngleTransform;

            int bitmapWidth  = thisWidth;
            int bitmapHeight = ncMetrics.Bottom;

            if (bitmapWidth <= 0 || bitmapHeight <= 0)
            {
                return(null);
            }

            Padding borderThickness = this.GetBorderThickness(false);

            Bitmap   bottomBitmap   = new Bitmap(thisWidth, ncMetrics.Bottom);
            Graphics bottomGraphics = Graphics.FromImage(bottomBitmap);

            using (bottomGraphics)
            {
                Padding        footerMargin = this.Footer.Margin;
                RadGdiGraphics radGraphics  = new RadGdiGraphics(bottomGraphics);

                using (SolidBrush backGroundBrush = new SolidBrush(this.BackColor))
                {
                    Bitmap footerBitmap = this.Footer.GetAsBitmap(backGroundBrush, angleTransform, scaleSize);
                    if (footerBitmap != null)
                    {
                        bottomGraphics.DrawImage(footerBitmap,
                                                 new Point(borderThickness.Left + footerMargin.Left, -footerMargin.Bottom - borderThickness.Bottom));
                    }
                }
                radGraphics.TranslateTransform(0, -(thisHeight - ncMetrics.Bottom));
                this.BorderPrimitiveImpl.PaintBorder(radGraphics, angleTransform, scaleSize);
            }

            return(bottomBitmap);
        }
Example #6
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();
            }
        }