示例#1
0
        public override void RenderPage(XGraphics gfx)
        {
            base.RenderPage(gfx);

            // Create a new graphical path
            XGraphicsPath path = new XGraphicsPath();

            // Add the outline of the glyphs of the word 'Clip' to the path
            path.AddString("Clip!", new XFontFamily("Times New Roman"), XFontStyle.BoldItalic, 250, new XPoint(30, 100), XStringFormats.Default);

#if DEBUG_
            gfx.WriteComment("SetClip");
#endif
            // Set the path as clip path
            gfx.IntersectClip(path);
#if DEBUG_
            gfx.WriteComment("Random lines");
#endif
            // Draw some random lines to show that clipping happens
            Random rnd = new Random(42);
            for (int idx = 0; idx < 300; idx++)
            {
                gfx.DrawLine(properties.Pen2.Pen, rnd.Next(600), rnd.Next(500), rnd.Next(600), rnd.Next(500));
            }
        }
示例#2
0
        public override void RenderPage(XGraphics gfx)
        {
            base.RenderPage(gfx);
            DrawGridlines(gfx);

            // Create a new graphical path
            XGraphicsPath path = new XGraphicsPath();

            XSize  size          = new XSize(90, 140);
            double rotationAngle = 130;

            path.AddArc(new XPoint(100, 100), new XPoint(200, 200), size, rotationAngle, false, System.Windows.Media.SweepDirection.Clockwise);
            path.StartFigure();
            path.AddArc(new XPoint(400, 100), new XPoint(500, 200), size, rotationAngle, false, System.Windows.Media.SweepDirection.Counterclockwise);
            path.StartFigure();
            path.AddArc(new XPoint(100, 300), new XPoint(200, 400), size, rotationAngle, true, System.Windows.Media.SweepDirection.Clockwise);
            path.StartFigure();
            path.AddArc(new XPoint(400, 300), new XPoint(500, 400), size, rotationAngle, true, System.Windows.Media.SweepDirection.Counterclockwise);
            path.StartFigure();

#if DEBUG_
            gfx.WriteComment("PathArcSegment");
#endif
            gfx.DrawPath(XPens.Red, path);
        }
        /// <summary>
        /// Demonstrates the use of XGraphics.DrawRoundedRectangle.
        /// </summary>
        public override void RenderPage(XGraphics gfx)
        {
            base.RenderPage(gfx);

#if DEBUG
            gfx.WriteComment("begin DrawRoundedRectangle");
#endif
            // Stroke rounded rectangle
            gfx.DrawRoundedRectangle(properties.Pen1.Pen, 50, 100, 450, 150, 50, 30);
#if DEBUG
            gfx.WriteComment("end DrawRoundedRectangle");
#endif

            // Fill rounded rectangle
            gfx.DrawRoundedRectangle(properties.Brush2.Brush, new Rectangle(50, 300, 450, 150), new SizeF(30, 20));

            // Stroke and fill rounded rectangle
            gfx.DrawRoundedRectangle(properties.Pen2.Pen, properties.Brush2.Brush,
                                     new XRect(50, 500, 450, 150), new XSize(75, 75));
        }
示例#4
0
        public override void RenderPage(XGraphics gfx)
        {
            //base.RenderPage(gfx);

            XFont font1 = new XFont("Times New Roman", 12);
            XFont font2 = new XFont("Courier New", 10, XFontStyle.Bold);

            gfx.WriteComment("Word 11");
            gfx.DrawString("Word 11", font1, XBrushes.Black, new XPoint(50, 100));

            gfx.WriteComment("Word 12");
            gfx.DrawString("Word 12", font1, XBrushes.Black, new XPoint(100, 100));


            gfx.WriteComment("Word 21");
            gfx.DrawString("Word 21", font2, XBrushes.Black, new XPoint(50, 200));

            gfx.WriteComment("Word 22");
            gfx.DrawString("Word 22", font2, XBrushes.Black, new XPoint(100, 200));

            gfx.WriteComment("Word 23");
            gfx.DrawString("Word 22", font2, XBrushes.Red, new XPoint(150, 200));

            gfx.WriteComment("Word 24");
            gfx.DrawString("Word 24", font2, XBrushes.Red, new XPoint(200, 200));
        }