Pen.StartCap : Pen « System.Drawing « C# / C Sharp by API






Pen.StartCap

 

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Drawing.Drawing2D;

public class Form1 : System.Windows.Forms.Form {
    [STAThread]
    static void Main() {
        Application.Run(new Form1());
    }
    protected override void OnPaint(PaintEventArgs e) {
        Graphics g = e.Graphics;
        Pen p = new Pen(Color.Brown, 15);

        p.StartCap = LineCap.SquareAnchor;
        p.EndCap = LineCap.SquareAnchor;
        g.DrawLine(p, 30, 190, Width - 50, 190);

    }
}

   
  








Related examples in the same category

1.new Pen(ForeColor)
2.new Pen(Color.Black, 2)
3.Pen.DashCap.Triangle
4.Pen.DashPattern
5.Pen.DashStyle
6.Pen.Dispose()
7.Pen.LineJoin