Add Line and Arc to Path

image_pdfimage_print
   
 

using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
   
class LineArcPath: Form
{
     public static void Main()
     {
          Application.Run(new LineArcPath());
     }
     protected override void OnPaint(PaintEventArgs pea)
     {
          DoPage(pea.Graphics, ForeColor,ClientSize.Width, ClientSize.Height);
     }      
     protected void DoPage(Graphics grfx, Color clr, int cx, int cy)
     {
          GraphicsPath path = new GraphicsPath();
          Pen          pen  = new Pen(clr, 25);
   
          path.AddLine( 25, 100, 125, 100);
          path.AddArc (125,  50, 100, 100, -180, 180);
          path.AddLine(225, 100, 325, 100);
   
          grfx.DrawPath(pen, path);
     }
}

    


This entry was posted in 2D Graphics. Bookmark the permalink.