当前位置: 首页>>代码示例>>C#>>正文


C# Drawing.XPen类代码示例

本文整理汇总了C#中PdfSharp.Drawing.XPen的典型用法代码示例。如果您正苦于以下问题:C# XPen类的具体用法?C# XPen怎么用?C# XPen使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


XPen类属于PdfSharp.Drawing命名空间,在下文中一共展示了XPen类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RenderPage

    /// <summary>
    /// Demonstrates the use of XGraphics.DrawBeziers.
    /// </summary>
    public override void RenderPage(XGraphics gfx)
    {
      base.RenderPage(gfx);

      int n = 2;
      int count = 1 + 3 * n;
      XPoint[] points = new XPoint[count];
      Random rnd = new Random(42);
      for (int idx = 0; idx < count; idx++)
      {
        points[idx].X = 20 + rnd.Next(600);
        points[idx].Y = 50 + rnd.Next(800);
      }

      // Draw the points
      XPen pen = new XPen(XColors.Red, 0.5);
      pen.DashStyle = XDashStyle.Dash;
      for (int idx = 0; idx + 3 < count; idx += 3)
      {
        gfx.DrawEllipse(XBrushes.Red, MakeRect(points[idx]));
        gfx.DrawEllipse(XBrushes.Red, MakeRect(points[idx + 1]));
        gfx.DrawEllipse(XBrushes.Red, MakeRect(points[idx + 2]));
        gfx.DrawEllipse(XBrushes.Red, MakeRect(points[idx + 3]));
        gfx.DrawLine(pen, points[idx], points[idx + 1]);
        gfx.DrawLine(pen, points[idx + 2], points[idx + 3]);
      }

      // Draw the curve
      gfx.DrawBeziers(properties.Pen2.Pen, points);
    }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:33,代码来源:LinesBezierCurves.cs

示例2: RenderArcs

    /// <summary>
    /// Draws Arcs.
    /// </summary>
    void RenderArcs(XGraphics gfx)
    {
      gfx.TranslateTransform(15, 20);

      XPen pen = new XPen(XColors.Plum, 4.7);
      gfx.DrawArc(pen, 0, 0, 250, 140, 190, 200);
    }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:10,代码来源:Arcs.cs

示例3: RenderLines

    /// <summary>
    /// Draws simple lines.
    /// </summary>
    void RenderLines(XGraphics gfx)
    {
      gfx.TranslateTransform(15, 20);

      gfx.DrawLine(XPens.Red, new XPoint(10, 10), new XPoint(300, 300));

      gfx.DrawLine(XPens.DarkGreen, 0, 0, 250, 0);

      gfx.DrawLine(XPens.Gold, 15, 7, 230, 15);

      XPen pen = new XPen(XColors.Navy, 4);
      gfx.DrawLine(pen, 0, 20, 250, 20);

      pen = new XPen(XColors.Firebrick, 6);
      pen.DashStyle = XDashStyle.Dash;
      gfx.DrawLine(pen, 0, 40, 250, 40);
      pen.Width = 7.3;
      pen.DashStyle = XDashStyle.DashDotDot;
      gfx.DrawLine(pen, 0, 60, 250, 60);

      pen = new XPen(XColors.Goldenrod, 10);
      pen.LineCap = XLineCap.Flat;
      gfx.DrawLine(pen, 10, 90, 240, 90);
      gfx.DrawLine(XPens.Black, 10, 90, 240, 90);

      pen = new XPen(XColors.Goldenrod, 10);
      pen.LineCap = XLineCap.Square;
      gfx.DrawLine(pen, 10, 110, 240, 110);
      gfx.DrawLine(XPens.Black, 10, 110, 240, 110);

      pen = new XPen(XColors.Goldenrod, 10);
      pen.LineCap = XLineCap.Round;
      gfx.DrawLine(pen, 10, 130, 240, 130);
      gfx.DrawLine(XPens.Black, 10, 130, 240, 130);
    }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:38,代码来源:Lines.cs

示例4: RenderClock

    /// <summary>
    /// Draws a clock on a square page.
    /// Inspired by Charles Petzold's AnalogClock sample in
    /// 'Programming Microsoft Windows with C#'.
    /// </summary>
    void RenderClock(XGraphics gfx)
    {
      // Clocks should always look happy on hardcopies...
      //this.time = new DateTime(2005, 1, 1, 11, 6, 22, 500);

      XColor strokeColor = XColors.DarkBlue;
      XColor fillColor = XColors.DarkOrange;

      XPen pen = new XPen(strokeColor, 5);
      XBrush brush = new XSolidBrush(fillColor);

      strokeColor.A = 0.8;
      fillColor.A = 0.8;
      XPen handPen = new XPen(strokeColor, 5);
      XBrush handBrush = new XSolidBrush(fillColor);

      DrawText(gfx, pen, brush);

      double width = gfx.PageSize.Width;
      double height = gfx.PageSize.Height;
      gfx.TranslateTransform(width / 2, height / 2);
      double scale = Math.Min(width, height);
      gfx.ScaleTransform(scale / 2000);

      DrawFace(gfx, pen, brush);
      DrawHourHand(gfx, handPen, handBrush);
      DrawMinuteHand(gfx, handPen, handBrush);
      DrawSecondHand(gfx, new XPen(XColors.Red, 7));
    }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:34,代码来源:Clock.aspx.cs

示例5: BeginBox

        /// <summary>
        /// Draws a sample box.
        /// </summary>
        public void BeginBox(XGraphics gfx, int number)
        {
            //obracene XY
            gfx.RotateAtTransform(90.0, new XPoint(height / 4, width / 4));
            gfx.TranslateTransform(+62, +63);
            //const int dEllipse = 15;
            XRect rect = new XRect(0, 0, height /2 -2, width/2 -2);

            if (number % 2 == 0)
                rect.X += height/2 +2;
            rect.Y =  ((number - 1) / 2) * (-width/2 - 3);
            //rect.Inflate(-10, -10);
            //XRect rect2 = rect;

            XPen pen = new XPen(XColors.Black, 1);

            gfx.DrawRectangle(pen, rect.X, rect.Y, rect.Width, rect.Height);

            //rect2.Offset(this.borderWidth, this.borderWidth);
            //gfx.DrawRoundedRectangle(new XSolidBrush(this.shadowColor), rect2, new XSize(dEllipse + 8, dEllipse + 8));
            //XLinearGradientBrush brush = new XLinearGradientBrush(rect, this.backColor, this.backColor2, XLinearGradientMode.Vertical);
            //gfx.DrawRoundedRectangle(this.borderPen, brush, rect, new XSize(dEllipse, dEllipse));
            //rect.Inflate(-5, -5);

            //rect.Inflate(-10, -5);
            //rect.Y += 20;
            //rect.Height -= 20;
            ////gfx.DrawRectangle(XPens.Red, rect);

            //    gfx.TranslateTransform(rect.X, rect.Y);

            this.state = gfx.Save();
        }
开发者ID:Jeycob,项目名称:PenezniDenik,代码行数:36,代码来源:PDFbase.cs

示例6: DrawLine

    /// <summary>
    /// Draws simple lines.
    /// </summary>
    void DrawLine(XGraphics gfx, int number)
    {
      BeginBox(gfx, number, "DrawLine");

      gfx.DrawLine(XPens.DarkGreen, 0, 0, 250, 0);

      gfx.DrawLine(XPens.Gold, 15, 7, 230, 15);

      XPen pen = new XPen(XColors.Navy, 4);
      gfx.DrawLine(pen, 0, 20, 250, 20);

      pen = new XPen(XColors.Firebrick, 6);
      pen.DashStyle = XDashStyle.Dash;
      gfx.DrawLine(pen, 0, 40, 250, 40);
      pen.Width = 7.3;
      pen.DashStyle = XDashStyle.DashDotDot;
      gfx.DrawLine(pen, 0, 60, 250, 60);

      pen = new XPen(XColors.Goldenrod, 10);
      pen.LineCap = XLineCap.Flat;
      gfx.DrawLine(pen, 10, 90, 240, 90);
      gfx.DrawLine(XPens.Black, 10, 90, 240, 90);

      pen = new XPen(XColors.Goldenrod, 10);
      pen.LineCap = XLineCap.Square;
      gfx.DrawLine(pen, 10, 110, 240, 110);
      gfx.DrawLine(XPens.Black, 10, 110, 240, 110);

      pen = new XPen(XColors.Goldenrod, 10);
      pen.LineCap = XLineCap.Round;
      gfx.DrawLine(pen, 10, 130, 240, 130);
      gfx.DrawLine(XPens.Black, 10, 130, 240, 130);

      EndBox(gfx);
    }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:38,代码来源:LinesAndCurves.cs

示例7: RenderCurves

    /// <summary>
    /// Draws curves.
    /// </summary>
    void RenderCurves(XGraphics gfx)
    {
      gfx.TranslateTransform(15, 20);

      XPoint[] points = { new XPoint(20, 30), new XPoint(60, 120), new XPoint(90, 20), new XPoint(170, 90), new XPoint(230, 40) };
      XPen pen = new XPen(XColors.RoyalBlue, 3.5);
      gfx.DrawCurve(pen, points, 1);
    }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:11,代码来源:Curves.cs

示例8: DrawDebuggingCrosshair

 private void DrawDebuggingCrosshair(XGraphics context)
 {
     var pen = new XPen(XColors.Red);
     var w = form.Size.Width;
     var h = form.Size.Height;
     context.DrawLine(pen, 0, 0, w, h);
     context.DrawLine(pen, w, 0, 0, h);
 }
开发者ID:tinyplasticgreyknight,项目名称:pocketmodise,代码行数:8,代码来源:Subpage.cs

示例9: RenderClosedCurves

    void RenderClosedCurves(XGraphics gfx)
    {
      gfx.TranslateTransform(15, 20);

      XPen pen = new XPen(XColors.DarkBlue, 2.5);
      gfx.DrawClosedCurve(pen, XBrushes.SkyBlue,
        new XPoint[] { new XPoint(10, 120), new XPoint(80, 30), new XPoint(220, 20), new XPoint(170, 110), new XPoint(100, 90) },
        XFillMode.Winding, 0.7);
    }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:9,代码来源:ClosedCurves.cs

示例10: MakePen

        private static XPen MakePen(bool dotted)
        {
            var pen = new XPen(XColors.Black);
            if (dotted) {
                pen.DashStyle = XDashStyle.Dash;
            }

            return pen;
        }
开发者ID:tinyplasticgreyknight,项目名称:pocketmodise,代码行数:9,代码来源:Superpage.cs

示例11: RenderPolygons

    void RenderPolygons(XGraphics gfx)
    {
      gfx.TranslateTransform(15, 20);

      XPen pen = new XPen(XColors.DarkBlue, 2.5);

      gfx.DrawPolygon(pen, XBrushes.LightCoral, GeometryObjects.GetPentagram(50, new XPoint(60, 70)), XFillMode.Winding);
      gfx.DrawPolygon(pen, XBrushes.LightCoral, GeometryObjects.GetPentagram(50, new XPoint(180, 70)), XFillMode.Alternate);
    }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:9,代码来源:Polygons.cs

示例12: XPoint

    /// <summary>
    /// Draws Bézier curves.
    /// </summary>
    void RenderBéziers(XGraphics gfx)
    {
      gfx.TranslateTransform(15, 20);

      XPoint[] points =  {new XPoint(20, 30), new XPoint(40, 120), new XPoint(80, 20), new XPoint(110, 90), 
                                new XPoint(180, 40), new XPoint(210, 40), new XPoint(220, 80)};
      XPen pen = new XPen(XColors.Firebrick, 4);
      //pen.DashStyle = XDashStyle.Dot;
      gfx.DrawBeziers(pen, points);
    }
开发者ID:vronikp,项目名称:EventRegistration,代码行数:13,代码来源:Beziers.cs

示例13: RenderEllipses

    void RenderEllipses(XGraphics gfx)
    {
      gfx.TranslateTransform(15, 20);

      XPen pen = new XPen(XColors.Navy, Math.PI);

      gfx.DrawRectangle(pen, 10, 0, 100, 60);
      gfx.DrawRectangle(XBrushes.DarkOrange, 130, 0, 100, 60);
      gfx.DrawRectangle(pen, XBrushes.DarkOrange, 10, 80, 100, 60);
      gfx.DrawRectangle(pen, XBrushes.DarkOrange, 150, 80, 60, 60);
    }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:11,代码来源:Ellipses.cs

示例14: RenderPies

    void RenderPies(XGraphics gfx)
    {
      gfx.TranslateTransform(15, 20);

      XPen pen = new XPen(XColors.DarkBlue, 2.5);

      gfx.DrawPie(pen, 10, 0, 100, 90, -120, 75);
      gfx.DrawPie(XBrushes.Gold, 130, 0, 100, 90, -160, 150);
      gfx.DrawPie(pen, XBrushes.Gold, 10, 50, 100, 90, 80, 70);
      gfx.DrawPie(pen, XBrushes.Gold, 150, 80, 60, 60, 35, 290);
    }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:11,代码来源:Pies.cs

示例15: RenderRoundedRectangles

    void RenderRoundedRectangles(XGraphics gfx)
    {
      gfx.TranslateTransform(15, 20);

      XPen pen = new XPen(XColors.RoyalBlue, Math.PI);

      gfx.DrawRoundedRectangle(pen, 10, 0, 100, 60, 30, 20);
      gfx.DrawRoundedRectangle(XBrushes.Orange, 130, 0, 100, 60, 30, 20);
      gfx.DrawRoundedRectangle(pen, XBrushes.Orange, 10, 80, 100, 60, 30, 20);
      gfx.DrawRoundedRectangle(pen, XBrushes.Orange, 150, 80, 60, 60, 20, 20);
    }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:11,代码来源:RoundedRectangles.cs


注:本文中的PdfSharp.Drawing.XPen类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。