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


C# XGraphics.DrawLines方法代码示例

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


在下文中一共展示了XGraphics.DrawLines方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RenderPage

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

      XPoint[] points = new XPoint[]
      {
        new XPoint(50, 100),
        new XPoint(450, 120),
        new XPoint(550, 300),
        new XPoint(150, 380),
        new XPoint(120, 190),
      };

      gfx.DrawLines(properties.Pen2.Pen, points);
    }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:18,代码来源:LinesPolyLines.cs

示例2: RenderPage

    /// <summary>
    /// Source and more infos: http://www.math.dartmouth.edu/~dlittle/java/SpiroGraph/
    /// </summary>
    public override void RenderPage(XGraphics gfx)
    {
      base.RenderPage(gfx);

      //int R =  60, r =  60, p =   60, N = 270; // Cardioid
      //int R =  60, r = -45, p = -101, N = 270; // Rounded Square
      //int R =  75, r = -25, p =   85, N = 270; // Gold fish
      //int R =  75, r = -30, p =   60, N = 270; // Star fish
      //int R = 100, r =  49, p =   66, N =   7; // String of Pearls
      //int R =  90, r =   1, p =  105, N = 105; // Rotating Triangle

      //int R =  90, r =   1, p =  105, N = 105;
      int R =  60, r =   2, p =  122, N = 490;

      int revs = Math.Abs(r) / Gcd(R, Math.Abs(r));
      XPoint[] points = new XPoint[revs * N + 1];
      for (int i = 0; i <= revs * N; i++)
      {
        double t = 4 * i * Math.PI / N;
        points[i].X = ((R+r)*Math.Cos(t) - p * Math.Cos((R+r)* t / r));
        points[i].Y = ((R+r)*Math.Sin(t) - p * Math.Sin((R+r)* t / r));
      }

#if true
      // Draw as lines
      gfx.TranslateTransform(300, 250);
      gfx.DrawLines(properties.Pen2.Pen, points);

      //gfx.DrawPolygon(properties.Pen2.Pen, properties.Brush2.Brush, points, properties.General.FillMode);

      // Draw as closed curve
      gfx.TranslateTransform(0, 400);
      gfx.DrawClosedCurve(properties.Pen2.Pen, properties.Brush2.Brush, points, properties.General.FillMode,
        properties.General.Tension);
#else
      gfx.TranslateTransform(300, 400);
      XSolidBrush dotBrush = new XSolidBrush(properties.Pen2.Pen.Color);
      float width = properties.Pen2.Width;
      for (int i = 0; i < revs * N; i++)
        gfx.DrawEllipse(dotBrush,points[i].X, points[i].Y, width, width);
#endif
    }
开发者ID:vronikp,项目名称:EventRegistration,代码行数:45,代码来源:MiscSpiroGraph.cs

示例3: DrawLines

    /// <summary>
    /// Draws a ployline.
    /// </summary>
    void DrawLines(XGraphics gfx, int number)
    {
      BeginBox(gfx, number, "DrawLines");

      XPen pen = new XPen(XColors.DarkSeaGreen, 6);
      pen.LineCap = XLineCap.Round;
      pen.LineJoin = XLineJoin.Bevel;
      XPoint[] points =
        new XPoint[] { new XPoint(20, 30), new XPoint(60, 120), new XPoint(90, 20), new XPoint(170, 90), new XPoint(230, 40) };
      gfx.DrawLines(pen, points);

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

示例4: RenderPolyLines

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

      XPen pen = new XPen(XColors.DarkSeaGreen, 6);
      pen.LineCap = XLineCap.Round;
      pen.LineJoin = XLineJoin.Bevel;
      XPoint[] points =
        new XPoint[] { new XPoint(20, 30), new XPoint(60, 120), new XPoint(90, 20), new XPoint(170, 90), new XPoint(230, 40) };
      gfx.DrawLines(pen, points);
    }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:14,代码来源:Lines.cs

示例5: DrawHandMadeArc

    public void DrawHandMadeArc(XGraphics gfx, XPen pen, XRect rect, double startAngle, double sweepAngle)
    {
      const double deg2rad = Math.PI / 180;
      double dx = rect.Width / 2;
      double dy = rect.Height / 2;
      double x0 = rect.X + dx;
      double y0 = rect.Y + dy;

      double a = startAngle;
      if (a < 0)
        a =  a + (1 + Math.Floor((Math.Abs(a) / 360))) * 360;
      else if (a > 360)
        a =  a - Math.Floor(a / 360) * 360;

      double b = startAngle + sweepAngle;
      if (b < 0)
        b =  b + (1 + Math.Floor((Math.Abs(b) / 360))) * 360;
      else if (b > 360)
        b =  b - Math.Floor(b / 360) * 360;

      a *= deg2rad;
      b *= deg2rad;

      if (rect.Width != rect.Height)
      {
        double sina = Math.Sin(a);
        if (Math.Abs(sina) > 1E-10)
        {
          if (a < Math.PI)
            a = Math.PI / 2 - Math.Atan(dy * Math.Cos(a) / (dx * sina));
          else
            a = 3 * Math.PI / 2 - Math.Atan(dy * Math.Cos(a) / (dx * sina));
        }
        double sinb = Math.Sin(b);
        if (Math.Abs(sinb) > 1E-10)
        {
          if (b < Math.PI)
            b = Math.PI / 2 - Math.Atan(dy * Math.Cos(b) / (dx * sinb));
          else
            b = 3 * Math.PI / 2 - Math.Atan(dy * Math.Cos(b) / (dx * sinb));
        }
      }

      int count;
      double adeg = a / deg2rad;
      double bdeg = b / deg2rad;
      if (adeg < bdeg)
      {
        if (sweepAngle > 0)
          count = (int)(bdeg - adeg) + 1;
        else
          count = 361 - (int)(bdeg - adeg);
      }
      else
      {
        if (sweepAngle > 0)
          count = 361 - (int)(adeg - bdeg);
        else
          count = (int)(adeg - bdeg) + 1;
      }
      if (count < 2)
        count = 2;
      XPoint[] points = new XPoint[count];
      double delta = sweepAngle > 0 ? deg2rad : -deg2rad;
#if true_
      gfx.DrawLine(XPens.Green, x0, y0, x0 + dx * Math.Cos(a), y0 + dy * Math.Sin(a));
      gfx.DrawLine(XPens.Green, x0, y0, x0 + dx * Math.Cos(b), y0 + dy * Math.Sin(b));
#endif
      for (int idx = 0; idx < count; idx++)
      {
        double angle;
        if (idx + 1 != count)
          angle = a + idx * delta;
        else
          angle = b;
        points[idx].X = x0 + dx * Math.Cos(angle);
        points[idx].Y = y0 + dy * Math.Sin(angle);
      }
      gfx.DrawLines(pen, points);
    }
开发者ID:AnthonyNystrom,项目名称:Pikling,代码行数:80,代码来源:LinesArc.cs

示例6: DrawAxes

 void DrawAxes(XGraphics gfx, XPen pen, PointF origin, float length)
 {
   gfx.DrawLines(pen, origin.X, origin.Y - length, origin.X, origin.Y, origin.X + length, origin.Y);
 }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:4,代码来源:TextTransform2.cs

示例7: DrawPentagon

        public void DrawPentagon(XGraphics gfx)
        {
            //set up the background grey
            XRect backgroundRect = new XRect(20, page_.Height * 0.11, page_.Width - 40, page_.Height * 0.425);
            DrawingUtil.DrawOutlineRect(backgroundRect, gfx, cornerRadius);
            gfx.DrawRoundedRectangle(backgroundBrush,
                backgroundRect,
                cornerRadius);
            XPoint center = new XPoint(page_.Width * 0.5, backgroundRect.Y + backgroundRect.Height * 0.6);

            XPoint[] polyPoints = DrawingUtil.Instance.GeneratePoints(center, 130, 5, gfx);
            gfx.DrawPolygon(backgroundBrush, polyPoints, XFillMode.Winding);

            XPen yellowPen = new XPen(XColors.Yellow, 2.5);
            XPen greenPen = new XPen(XColors.Green, 2.5);
            XPen perimeterPen = XPens.LightGray;
            XPen redPen = new XPen(XColors.Red, 2.5);

            //center out
            foreach(XPoint p in polyPoints)
                gfx.DrawLine(greenPen, center, p);

            XBrush brush = XBrushes.Black;
            XSize size = new XSize(50, 50);
            XSize ellipseSize = new XSize(10, 10);
            //images
            XImage leftKneeImg = XImage.FromFile(Directory.GetCurrentDirectory() + @"\Content\LKS.png");
            XImage rightKneeImg = XImage.FromFile(Directory.GetCurrentDirectory() + @"\Content\RKS.png");
            XImage tibia_spineImg = XImage.FromFile(Directory.GetCurrentDirectory() + @"\Content\STA.png");
            XImage dosImg = XImage.FromFile(Directory.GetCurrentDirectory() + @"\Content\DOS.png");
            XImage pelvicImg = XImage.FromFile(Directory.GetCurrentDirectory() + @"\Content\PS.png");

            //infoboxes
            DrawPentaInfoBox(gfx, polyPoints[0] + new XPoint(-50, -70), tibia_spineImg, userParameters_[dataReadStart + 1]);
            DrawPentaInfoBox(gfx, polyPoints[1] + new XPoint(25, -35), rightKneeImg, userParameters_[dataReadStart + 8]);
            DrawPentaInfoBox(gfx, polyPoints[2] + new XPoint(25, -60), pelvicImg, userParameters_[dataReadStart + 2]);
            DrawPentaInfoBox(gfx, polyPoints[3] + new XPoint(-125, -60), dosImg, userParameters_[dataReadStart + 0]);
            DrawPentaInfoBox(gfx, polyPoints[4] + new XPoint(-120,-35), leftKneeImg, userParameters_[dataReadStart + 3]);

            //percentage Lines
            gfx.DrawString(0 + "%", new XFont("Arial", 10), XBrushes.Black, center + new XPoint(5, 0));
            for (int j = 0; j < polyPoints.Length - 1; j++)
            {
                XPoint pt1 = polyPoints[j];
                XPoint pt2 = polyPoints[j + 1];

                for (int i = 10; i > 0; i--)
                {
                    float increment = -i * 0.1f;
                    if (j < 1)
                        gfx.DrawString((i * 10).ToString() + '%', new XFont("Arial", 8), XBrushes.Black, DrawingUtil.Instance.Interpolate(center, polyPoints[0], increment) + new XPoint(5, 0));

                    gfx.DrawLine(perimeterPen,
                        DrawingUtil.Instance.Interpolate(center, pt1, increment),
                        DrawingUtil.Instance.Interpolate(center, pt2, increment));
                }
            }

            XPoint centerTibia = DrawingUtil.Instance.Interpolate(center, polyPoints[0], -userParameters_[dataReadStart + 1].Percentage);
            XPoint centerRightKnee = DrawingUtil.Instance.Interpolate(center, polyPoints[1], -userParameters_[dataReadStart + 8].Percentage);
            XPoint centerPelvicStability = DrawingUtil.Instance.Interpolate(center, polyPoints[2], -userParameters_[dataReadStart + 2].Percentage);
            XPoint centerDos = DrawingUtil.Instance.Interpolate(center, polyPoints[3], -userParameters_[dataReadStart + 0].Percentage);
            XPoint centerLeftKnee = DrawingUtil.Instance.Interpolate(center, polyPoints[4], -userParameters_[dataReadStart + 3].Percentage);

            gfx.DrawLine(redPen, center, DrawingUtil.Instance.Interpolate(center, polyPoints[0], -userParameters_[dataReadStart + 1].RedVal));
            gfx.DrawLine(redPen, center, DrawingUtil.Instance.Interpolate(center, polyPoints[1], -userParameters_[dataReadStart + 8].RedVal));
            gfx.DrawLine(redPen, center, DrawingUtil.Instance.Interpolate(center, polyPoints[2], -userParameters_[dataReadStart + 2].RedVal));
            gfx.DrawLine(redPen, center, DrawingUtil.Instance.Interpolate(center, polyPoints[3], -userParameters_[dataReadStart + 0].RedVal));
            gfx.DrawLine(redPen, center, DrawingUtil.Instance.Interpolate(center, polyPoints[4], -userParameters_[dataReadStart + 3].RedVal));

            gfx.DrawPolygon(new XPen(XColor.FromArgb(1, 0, 255, 255)),
                new XSolidBrush(XColor.FromArgb(40,255,255,0)),
                new XPoint[] { centerTibia, centerRightKnee, centerPelvicStability, centerDos, centerLeftKnee },
                XFillMode.Alternate);

            gfx.DrawLines(new XPen(XColors.Orange, 1), new XPoint[] { centerTibia, centerRightKnee, centerPelvicStability, centerDos, centerLeftKnee, centerTibia });
        }
开发者ID:Nodgez,项目名称:PDFReporter,代码行数:77,代码来源:OHS_Page.cs

示例8: PrintTitleX

		public void PrintTitleX(XGraphics g,int x,int y) {
			Color cTitleTop=Color.White;
			Color cTitleBottom=Color.FromArgb(213,213,223);
			Color cTitleText=Color.Black;
			if(_useBlueTheme) {
				cTitleTop=Color.FromArgb(156,175,230);//191,205,245);//139,160,224);//114,136,201);//106,132,210);//109,129,191);//104,136,232);
				cTitleBottom=Color.FromArgb(60,90,150);//35,55,115);//49,63,105);//(20,47,126);
				cTitleText=Color.White;
			}
			LinearGradientBrush brushTitleBackground=new LinearGradientBrush(new Rectangle(x,y,Width,titleHeight),cTitleTop,cTitleBottom,LinearGradientMode.Vertical);
			XSolidBrush brushTitleText=new XSolidBrush(cTitleText);
			g.DrawRectangle(brushTitleBackground,p(x),p(y),p(Width),p(titleHeight));
			Font _titleFont=new Font(FontFamily.GenericSansSerif,10,FontStyle.Bold);
			XFont titleFont=new XFont(_titleFont.FontFamily.ToString(),_titleFont.Size,XFontStyle.Bold);
			//g.DrawString(title,titleFont,brushTitleText,p((float)x+(float)(Width/2-g.MeasureString(title,titleFont).Width/2)),p(y+2));
			DrawStringX(g,title,titleFont,brushTitleText,new XRect((float)x+(float)(Width/2),y,100,100),XStringAlignment.Center);
			//Outline the Title
			Color cOutline=Color.FromArgb(119,119,146);
			if(_useBlueTheme) {
				cOutline=Color.FromArgb(47,70,117);
			}
			using(Pen pen=new Pen(cOutline)) {
				//Draw line from LL to UL to UR to LR. top three sides of a rectangle.
				g.DrawLines(pen,new Point[] { 
					new Point(x,y+titleHeight),
					new Point(x,y),
					new Point(x+Width,y),
					new Point(x+Width,y+titleHeight) });
				//g.DrawRectangle(pen,0,0,Width-1,Height-1);
			}
			if(brushTitleBackground!=null) {
				brushTitleBackground.Dispose();
				brushTitleBackground=null;
			}
		}
开发者ID:mnisl,项目名称:OD,代码行数:35,代码来源:ODGrid.cs

示例9: DrawBackets

            private void DrawBackets(XGraphics gfx, int bracketNum, int pheight, int startX, int startY)
            {
                int width = 30;
                int height = pheight;
                //int form = distanceBetween
                int X = startX;
                int Y = startY;
                for (int i = 0; i < bracketNum; i++)
                {
                    gfx.DrawLines(XPens.Black, new[] {
                new XPoint(X, Y),
                new XPoint(X+width, Y),
                new XPoint(X+width, Y + height),
                new XPoint(X, Y + height) });

                    //add y to skip one
                    Y = (Y + height) + height;
                }
            }
开发者ID:shaileshgajula,项目名称:c8a5b00a-1d86-40ff-a172-35d865eeec09,代码行数:19,代码来源:PDFGridExport.cs

示例10: DrawGraph

        public void DrawGraph(XGraphics gfx)
        {
            double yOff = page_.Height * 0.11;

            XRect rect = new XRect(20, yOff, page_.Width - 40, page_.Height - (yOff + 20));
            DrawingUtil.DrawOutlineRect(rect, gfx, cornerRadius);

            gfx.DrawRoundedRectangle(backgroundBrush, rect, cornerRadius);
            XPoint center = new XPoint(page_.Width * 0.5, page_.Height * 0.45);

            //Left & right boxes
            XRect leftRect = new XRect(center.X - 250, yOff + 5, 160, 25);
            XRect rightRect = new XRect(center.X + 90, yOff + 5, 160, 25);
            DrawingUtil.DrawOutlineRect(leftRect, gfx, new XSize(10,10));
            gfx.DrawRoundedRectangle(XBrushes.Yellow, leftRect, new XSize(10, 10));
            DrawingUtil.DrawOutlineRect(rightRect, gfx, new XSize(10,10));
            gfx.DrawRoundedRectangle(XBrushes.CornflowerBlue, rightRect, new XSize(10, 10));
            gfx.DrawString("Left", new XFont("Arial", 20), XBrushes.Black, new XPoint(leftRect.X + 80, leftRect.Y + 15), XStringFormats.Center);
            gfx.DrawString("Right", new XFont("Arial", 20), XBrushes.Black, new XPoint(rightRect.X + 80, rightRect.Y + 15), XStringFormats.Center);

            float graphSize = (float)page_.Height * 0.175f;
            XPoint[] polyPoints = DrawingUtil.Instance.GeneratePoints(center, graphSize, 7, gfx);
            gfx.DrawPolygon(backgroundBrush, polyPoints, XFillMode.Winding);

            XPen yellowPen = new XPen(XColors.Yellow, 2.5);
            XPen greenPen = new XPen(XColors.Green, 2.5);
            XPen perimeterPen = XPens.LightGray;
            XPen redPen = new XPen(XColors.Red, 2.5);

            GraphIcon hipFlexImg = new GraphIcon(XImage.FromFile(Directory.GetCurrentDirectory() + @"\Content\HipFlex.png"),"Hip Flexion");
            GraphIcon hamStringImg = new GraphIcon(XImage.FromFile(Directory.GetCurrentDirectory() + @"\Content\HSExt.png"), "Hamstring Extension");
            GraphIcon hipAbdImg = new GraphIcon(XImage.FromFile(Directory.GetCurrentDirectory() + @"\Content\HipAbd.png"), "Hip Abduction");
            GraphIcon hipIntImg = new GraphIcon(XImage.FromFile(Directory.GetCurrentDirectory() + @"\Content\HipInt.png"), "Hip Internal Rotation");
            GraphIcon hipExtImg = new GraphIcon(XImage.FromFile(Directory.GetCurrentDirectory() + @"\Content\HipExt.png"), "Hip External Rotation");
            GraphIcon kneeFlexImg = new GraphIcon(XImage.FromFile(Directory.GetCurrentDirectory() + @"\Content\KneeFlex.png"), "Knee Flexion");
            GraphIcon AnkleFlexImg = new GraphIcon(XImage.FromFile(Directory.GetCurrentDirectory() + @"\Content\AnkleFlex.png"), "Ankle Flexion");

            GraphIcon[] icons = new GraphIcon[] { hipFlexImg, hamStringImg, hipAbdImg, hipIntImg, hipExtImg, kneeFlexImg, AnkleFlexImg };

            //center out
            for (int l = 0; l < polyPoints.Length - 1; l++)
                gfx.DrawLine(greenPen, center, polyPoints[l]);

            //percentage Lines & icons
            gfx.DrawString(0 + "%", new XFont("Arial", 10), XBrushes.Black, center + new XPoint(5, 0));
            for (int j = 0; j < polyPoints.Length - 1; j++)
            {
                XPoint pt1 = polyPoints[j];
                XPoint pt2 = polyPoints[j + 1];

                for (int i = 10; i > 0; i--)
                {
                    float increment = -i * 0.1f;
                    if (j < 1)
                        gfx.DrawString((i * 10).ToString() + '%', new XFont("Arial", 8), XBrushes.Black, DrawingUtil.Instance.Interpolate(center, polyPoints[0], increment) + new XPoint(5, 0));

                    gfx.DrawLine(perimeterPen,
                        DrawingUtil.Instance.Interpolate(center, pt1, increment),
                        DrawingUtil.Instance.Interpolate(center, pt2, increment));
                }

                XVector vec = new XVector(pt1.X, pt1.Y);
                XVector vec2 = new XVector(center.X, center.Y);

                XImage img = icons[j].img;
                double wRatio = (double)img.PixelWidth / (double)img.PixelHeight;

                XVector dir = vec2 - vec;
                dir.Normalize();
                double txtOffset = dir.X * -10;
                XPoint halfmg = new XPoint(-20, -20);
                XPoint imgpos = new XPoint(dir.X * (-graphSize - 50), dir.Y * (-graphSize - 50)) + center + halfmg;
                gfx.DrawImage(img, new XRect(imgpos, new XSize(wRatio * 60, 60)));
                gfx.DrawString(icons[j].txt, arialSmall, XBrushes.Black, imgpos + new XPoint(txtOffset, -10), XStringFormats.Center);
            }

            //leftSide
            XPoint[] percentagePoints = new XPoint[polyPoints.Length - 1];
            for (int k = 0; k < polyPoints.Length - 1; k++)
            {
                Parameter kv = userParameters_.ElementAt(k);
                percentagePoints[k] = DrawingUtil.Instance.Interpolate(center, polyPoints[k], -kv.Percentage);
                gfx.DrawLine(yellowPen, center, DrawingUtil.Instance.Interpolate(center, polyPoints[k], -kv.AmberVal));
                gfx.DrawLine(redPen, center, DrawingUtil.Instance.Interpolate(center, polyPoints[k], -kv.RedVal));
            }

            gfx.DrawPolygon(new XPen(XColor.FromArgb(1, 0, 255, 255)),
                new XSolidBrush(XColor.FromArgb(100, 255, 255, 0)),
                percentagePoints,
                XFillMode.Alternate);
            XPoint[] linePoints = new XPoint[percentagePoints.Length + 1];
            for (int i = 0; i < percentagePoints.Length; i++)
            {
                linePoints[i] = percentagePoints[i];
            }

            linePoints[linePoints.Length - 1] = percentagePoints[0];
            gfx.DrawLines(new XPen(XColor.FromArgb(255, 255, 255, 0), 2), linePoints);

            //right side
//.........这里部分代码省略.........
开发者ID:Nodgez,项目名称:PDFReporter,代码行数:101,代码来源:ROM_Page.cs


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