當前位置: 首頁>>代碼示例>>C#>>正文


C# XGraphicsPath.AddEllipse方法代碼示例

本文整理匯總了C#中PdfSharp.Drawing.XGraphicsPath.AddEllipse方法的典型用法代碼示例。如果您正苦於以下問題:C# XGraphicsPath.AddEllipse方法的具體用法?C# XGraphicsPath.AddEllipse怎麽用?C# XGraphicsPath.AddEllipse使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PdfSharp.Drawing.XGraphicsPath的用法示例。


在下文中一共展示了XGraphicsPath.AddEllipse方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: RenderAlternatePath

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

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

      // Alternate fill mode
      XGraphicsPath path = new XGraphicsPath();
      path.FillMode = XFillMode.Alternate;
      path.AddLine(10, 130, 10, 40);
      path.AddBeziers(new XPoint[]{new XPoint(10, 40), new XPoint(30, 0), new XPoint(40, 20), new XPoint(60, 40), 
                                   new XPoint(80, 60), new XPoint(100, 60), new XPoint(120, 40)});
      path.AddLine(120, 40, 120, 130);
      path.CloseFigure();
      path.AddEllipse(40, 80, 50, 40);
      gfx.DrawPath(pen, XBrushes.DarkOrange, path);
    }
開發者ID:bossaia,項目名稱:alexandrialibrary,代碼行數:17,代碼來源:AlternateAndWinding.cs

示例2: DrawPathAlternateAndWinding

    /// <summary>
    /// Draws an alternating and a winding path.
    /// </summary>
    void DrawPathAlternateAndWinding(XGraphics gfx, int number)
    {
      BeginBox(gfx, number, "DrawPath (alternate / winding)");

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

      // Alternate fill mode
      XGraphicsPath path = new XGraphicsPath();
      path.FillMode = XFillMode.Alternate;
      path.AddLine(10, 130, 10, 40);
      path.AddBeziers(new XPoint[]{new XPoint(10, 40), new XPoint(30, 0), new XPoint(40, 20), new XPoint(60, 40), 
                                   new XPoint(80, 60), new XPoint(100, 60), new XPoint(120, 40)});
      path.AddLine(120, 40, 120, 130);
      path.CloseFigure();
      path.AddEllipse(40, 80, 50, 40);
      gfx.DrawPath(pen, XBrushes.DarkOrange, path);

      // Winding fill mode
      path = new XGraphicsPath();
      path.FillMode = XFillMode.Winding;
      path.AddLine(130, 130, 130, 40);
      path.AddBeziers(new XPoint[]{new XPoint(130, 40), new XPoint(150, 0), new XPoint(160, 20), new XPoint(180, 40), 
                                   new XPoint(200, 60), new XPoint(220, 60), new XPoint(240, 40)});
      path.AddLine(240, 40, 240, 130);
      path.CloseFigure();
      path.AddEllipse(160, 80, 50, 40);
      gfx.DrawPath(pen, XBrushes.DarkOrange, path);

      EndBox(gfx);
    }
開發者ID:bossaia,項目名稱:alexandrialibrary,代碼行數:33,代碼來源:Paths.cs

示例3: Draw

    /// <summary>
    /// Draws the marker given through rendererInfo at the specified position. Position specifies
    /// the center of the marker.
    /// </summary>
    internal static void Draw(XGraphics graphics, XPoint pos, MarkerRendererInfo rendererInfo)
    {
      if (rendererInfo.MarkerStyle == MarkerStyle.None)
        return;

      double size = rendererInfo.MarkerSize;
      double size2 = size / 2;
      double x0, y0, x1, y1;
      double g;

      XPen foreground = new XPen(rendererInfo.MarkerForegroundColor, 0.5);
      XBrush background = new XSolidBrush(rendererInfo.MarkerBackgroundColor);

      XGraphicsPath gp = new XGraphicsPath();
      switch (rendererInfo.MarkerStyle)
      {
        case MarkerStyle.Square:
          x0 = pos.X - size2;
          y0 = pos.Y - size2;
          x1 = pos.X + size2;
          y1 = pos.Y + size2;
          gp.AddLine(x0, y0, x1, y0);
          gp.AddLine(x1, y0, x1, y1);
          gp.AddLine(x1, y1, x0, y1);
          gp.AddLine(x0, y1, x0, y0);
          break;

        case MarkerStyle.Diamond:
          gp.AddLine(x1 = pos.X + size2, pos.Y, pos.X, y0 = pos.Y - size2);
          gp.AddLine(pos.X, y0, x0 = pos.X - size2, pos.Y);
          gp.AddLine(x0, pos.Y, pos.X, y1 = pos.Y + size2);
          gp.AddLine(pos.X, y1, x1, pos.Y);
          break;

        case MarkerStyle.Triangle:
          y0 = pos.Y + size / 2;
          y1 = pos.Y - size / 2;
          g = Math.Sqrt(size * size * 4 / 3) / 2;
          gp.AddLine(pos.X, y1, pos.X + g, y0);
          gp.AddLine(pos.X + g, y0, pos.X - g, y0);
          gp.AddLine(pos.X - g, y0, pos.X, y1);
          break;

        case MarkerStyle.Plus:
          g = size2 / 4;
          gp.AddLine(pos.X - size2, pos.Y + g, pos.X - g, pos.Y + g);
          gp.AddLine(pos.X - g, pos.Y + g, pos.X - g, pos.Y + size2);
          gp.AddLine(pos.X - g, pos.Y + size2, pos.X + g, pos.Y + size2);
          gp.AddLine(pos.X + g, pos.Y + size2, pos.X + g, pos.Y + g);
          gp.AddLine(pos.X + g, pos.Y + g, pos.X + size2, pos.Y + g);
          gp.AddLine(pos.X + size2, pos.Y + g, pos.X + size2, pos.Y - g);
          gp.AddLine(pos.X + size2, pos.Y - g, pos.X + g, pos.Y - g);
          gp.AddLine(pos.X + g, pos.Y - g, pos.X + g, pos.Y - size2);
          gp.AddLine(pos.X + g, pos.Y - size2, pos.X - g, pos.Y - size2);
          gp.AddLine(pos.X - g, pos.Y - size2, pos.X - g, pos.Y - g);
          gp.AddLine(pos.X - g, pos.Y - g, pos.X - size2, pos.Y - g);
          gp.AddLine(pos.X - size2, pos.Y - g, pos.X - size2, pos.Y + g);
          break;

        case MarkerStyle.Circle:
        case MarkerStyle.Dot:
          x0 = pos.X - size2;
          y0 = pos.Y - size2;
          gp.AddEllipse(x0, y0, size, size);
          break;

        case MarkerStyle.Dash:
          x0 = pos.X - size2;
          y0 = pos.Y - size2 / 3;
          x1 = pos.X + size2;
          y1 = pos.Y + size2 / 3;
          gp.AddLine(x0, y0, x1, y0);
          gp.AddLine(x1, y0, x1, y1);
          gp.AddLine(x1, y1, x0, y1);
          gp.AddLine(x0, y1, x0, y0);
          break;

        case MarkerStyle.X:
          g = size / 4;
          gp.AddLine(pos.X - size2 + g, pos.Y - size2, pos.X, pos.Y - g);
          gp.AddLine(pos.X, pos.Y - g, pos.X + size2 - g, pos.Y - size2);
          gp.AddLine(pos.X + size2 - g, pos.Y - size2, pos.X + size2, pos.Y - size2 + g);
          gp.AddLine(pos.X + size2, pos.Y - size2 + g, pos.X + g, pos.Y);
          gp.AddLine(pos.X + g, pos.Y, pos.X + size2, pos.Y + size2 - g);
          gp.AddLine(pos.X + size2, pos.Y + size2 - g, pos.X + size2 - g, pos.Y + size2);
          gp.AddLine(pos.X + size2 - g, pos.Y + size2, pos.X, pos.Y + g);
          gp.AddLine(pos.X, pos.Y + g, pos.X - size2 + g, pos.Y + size2);
          gp.AddLine(pos.X - size2 + g, pos.Y + size2, pos.X - size2, pos.Y + size2 - g);
          gp.AddLine(pos.X - size2, pos.Y + size2 - g, pos.X - g, pos.Y);
          gp.AddLine(pos.X - g, pos.Y, pos.X - size2, pos.Y - size2 + g);
          break;

        case MarkerStyle.Star:
          {
            XPoint[] points = new XPoint[10];

//.........這裏部分代碼省略.........
開發者ID:inexorabletash,項目名稱:PDFsharp,代碼行數:101,代碼來源:MarkerRenderer.cs

示例4: RenderWindingPath

    void RenderWindingPath(XGraphics gfx)
    {
      gfx.TranslateTransform(15, 150);

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

      // Winding fill mode
      XGraphicsPath path = new XGraphicsPath();
      path = new XGraphicsPath();
      path.FillMode = XFillMode.Winding;
      path.AddLine(130, 130, 130, 40);
      path.AddBeziers(new XPoint[]{new XPoint(130, 40), new XPoint(150, 0), new XPoint(160, 20), new XPoint(180, 40), 
                                   new XPoint(200, 60), new XPoint(220, 60), new XPoint(240, 40)});
      path.AddLine(240, 40, 240, 130);
      path.CloseFigure();
      path.AddEllipse(160, 80, 50, 40);
      gfx.DrawPath(pen, XBrushes.DarkOrange, path);
    }
開發者ID:bossaia,項目名稱:alexandrialibrary,代碼行數:18,代碼來源:AlternateAndWinding.cs


注:本文中的PdfSharp.Drawing.XGraphicsPath.AddEllipse方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。