C#:Drawing Lines

From Progzoo
Jump to: navigation, search

g.DrawLine(Pens.Black,60,20,60,100) draws a line from (60,20) to (60,100) of the Graphic g.

We can control the thickness of the line and the end-cap.

The cap determines what happens at the end of a line.

Thickness and CAP style

We draw three thick black lines. Each has thickness 15. The System.Drawing.Drawing2D.LineCap can take many values See http://msdn.microsoft.com/en-us/library/system.drawing.drawing2d.linecap.aspx

  • Square
  • Flat
  • Round

The thin red lines are the same length. LineStyle.png


[Font] [Default] [Show] [Resize] [History] [Profile]