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


C# XGraphicsPath.AddLines方法代碼示例

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


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

示例1: Draw


//.........這裏部分代碼省略.........
          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];

            double radStep = 2 * Math.PI / 5;
            double outerCircle = size / 2;
            double innerCircle = size / 5;
            // outer circle
            double rad = -(Math.PI / 2); // 90°
            for (int idx = 0; idx < 10; idx += 2)
            {
              points[idx].X = pos.X + outerCircle * Math.Cos(rad);
              points[idx].Y = pos.Y + outerCircle * Math.Sin(rad);
              rad += radStep;
            }

            // inner circle
            rad = -(Math.PI / 4); // 45°
            double x = innerCircle * Math.Cos(rad);
            double y = innerCircle * Math.Sin(rad);
            points[1].X = pos.X + x;
            points[1].Y = pos.Y + y;
            points[9].X = pos.X - x;
            points[9].Y = pos.Y + y;
            rad += radStep;
            x = innerCircle * Math.Cos(rad);
            y = innerCircle * Math.Sin(rad);
            points[3].X = pos.X + x;
            points[3].Y = pos.Y + y;
            points[7].X = pos.X - x;
            points[7].Y = pos.Y + y;
            rad += radStep;
            y = innerCircle * Math.Sin(rad);
            points[5].X = pos.X;
            points[5].Y = pos.Y + y;
            gp.AddLines(points);
          }
          break;
      }

      gp.CloseFigure();
      if (rendererInfo.MarkerStyle != MarkerStyle.Dot)
      {
        graphics.DrawPath(background, gp);
        graphics.DrawPath(foreground, gp);
      }
    }
開發者ID:inexorabletash,項目名稱:PDFsharp,代碼行數:101,代碼來源:MarkerRenderer.cs


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