logo
CSharp_Graphics

Создание вложенного пера

How to: Draw a Line with Line Caps

You can draw the start or end of a line in one of several shapes called line caps. GDI+ supports several line caps, such as round, square, diamond, and arrowhead.

Example

You can specify line caps for the start of a line (start cap), the end of a line (end cap), or the dashes of a dashed line (dash cap).

The following example draws a line with an arrowhead at one end and a round cap at the other end. The illustration shows the resulting line:

Pen pen = new Pen(Color.FromArgb(255, 0, 0, 255), 8);

pen.StartCap = LineCap.ArrowAnchor;

pen.EndCap = LineCap.RoundAnchor;

e.Graphics.DrawLine(pen, 20, 175, 300, 175);

Compiling the Code