How to use CustomLineCap Class?!?!
I want to draw a line with My Custom Cap (Special Diamon cap), I have the start and end points, and its Pen,
I created an instance from CustomLineCap Class, and I draw the Diamond I want
but when I assign the cap to the CustomEndCap property for the Pen, it didn't draw it, and when I try to draw the cap my self it works..
Please I need help in this...
any idea please Thanks :)
This code works for me:
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
{
GraphicsPath dpath = new GraphicsPath();
dpath.AddLine(new Point(0,0), new Point(10,5));
dpath.AddLine(new Point(10,5), new Point(20,0));
dpath.AddLine(new Point(20,0), new Point(10,-5));
dpath.AddLine(new Point(10,-5), new Point(0,0));
CustomLineCap DiamondCap = new CustomLineCap(null, dpath);
Pen capPen = new Pen(Color.Black, 5);
capPen.CustomStartCap = DiamondCap;
capPen.CustomEndCap = DiamondCap;
Point[] points =
{
new Point(100, 100),
new Point(200, 50),
new Point(250, 300)
};
e.Graphics.DrawLines(capPen, points);
}