Line Joins: Miter, Bevel, Round, MiterClipped : Line Join « 2D Graphics « C# / C Sharp






Line Joins: Miter, Bevel, Round, MiterClipped

 
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
   
class LineJoins: Form
{
     public static void Main()
     {
          Application.Run(new LineJoins());
     }
     public LineJoins()
     {
          ResizeRedraw = true; 
     }
     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)
     {
          Pen     penNarrow = new Pen(clr);
          Pen     penWide   = new Pen(Color.Gray, cx / 16);
          Point[] apt       = { new Point(1 * cx / 32, 1 * cy / 8), 
                                new Point(4 * cx / 32, 6 * cy / 8),
                                new Point(7 * cx / 32, 1 * cy / 8) };
   
          for (int i = 0; i < 4; i++)
          {
               penWide.LineJoin = (LineJoin) i;
   
               grfx.DrawLines(penWide, apt);
               grfx.DrawLines(penNarrow, apt);
               grfx.TranslateTransform(cx / 4, 0);
          }
     }
}

 








Related examples in the same category

1.All Line JoinAll Line Join
2.Line Join style: BevelLine Join style: Bevel