# How to draw line and curve with GraphicPath?

• ### Question

• I always get good answers in msdn.Thank you.
Currently, I have a problem with path.I use the List <point> and path.AddLines to draw a line.When I make three points, it creates a triangle.I want to a line with path.
How to draw a line with the path?
I need a straight line can be easily converted to curves and modify it.
Monday, January 30, 2012 9:39 AM

### All replies

• Below code will you help you to draw a line in the form using Drawing2D namespace:

```GraphicsPath myPath = new GraphicsPath();
e.Graphics.DrawPath(new Pen(Color.Black, 2), myPath);```
Monday, January 30, 2012 11:06 AM
• Hi tuanhp_1605,

Have a look at the samle like this:

http://www.codeproject.com/Articles/31859/Draw-a-Smooth-Curve-through-a-Set-of-2D-Points-wit

Best Regards

Neddy Ren[MSFT]
MSDN Community Support | Feedback to us
• Marked as answer by Thursday, February 9, 2012 9:21 AM
Wednesday, February 1, 2012 6:22 AM
• Marked as answer by Thursday, February 9, 2012 9:21 AM
Thursday, February 2, 2012 5:29 AM
• GraphicPath Has AddCurve (Point point, float).If float = 0.0f,it draws a line.Float = 1.0f -> curve.I use AddCurve to make segments.I have a curve/ line when I change the value of the float.But there is a problem.Each segment will be added to the List <Curve>.We need to group when using Matrix Translate and select.
Thursday, February 2, 2012 6:27 AM
• GraphicPath Has AddCurve (Point point, float).If float = 0.0f,it draws a line.Float = 1.0f -> curve.I use AddCurve to make segments.I have a curve/ line when I change the value of the float.But there is a problem.Each segment will be added to the List <Curve>.We need to group when using Matrix Translate and select.