gnosis
gnosis

Reputation: 929

HOWTO: Paint a dotted line in .NET (WinForms)

How can i draw a dotted line in .NET/WinForms/GDI+?

Pen p = new Pen (Color.Black) 

gives me only solid line pen.

I am trying to have a dotted (or dashed) lines; can't seem to be able to google it up successfully.

Will much appreciate any help on this one.

Upvotes: 16

Views: 13487

Answers (2)

Ty.
Ty.

Reputation: 2220

Set the DashStyle property on your Pen object.

Upvotes: 2

cfeduke
cfeduke

Reputation: 23226

p.DashStyle = DashStyle.Dash;

I believe.

Upvotes: 31

Related Questions