Click here to Skip to main content
15,919,879 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hi

I Using this code for draw a pic. Link:

Link:http://up3.iranblog.com/images/jjx4pf5qpbocceymr1.png[^]


VB
Dim x As Integer = 2
        Dim y As Integer = 2
        Dim w As Integer = 400
        Dim h As Integer = 400
        Dim r As Integer = 30



        Dim path As GraphicsPath = New GraphicsPath()
        path.AddArc(x, y, r, r, 180, 90)
        path.AddLine(x + r, y, x + w - r, y)

        path.CloseFigure()
Posted
Comments
Sander Rossel 27-Nov-11 7:56am    
What is your question?
[no name] 27-Nov-11 21:26pm    
Clarify your question please

1 solution

Just use Graphics.DrawPath:
VB
Dim x As Integer = 2
Dim y As Integer = 2
Dim w As Integer = 400
'int h = 400;
Dim r As Integer = 30

Dim path As New System.Drawing.Drawing2D.GraphicsPath()
path.AddArc(x, y, r, r, 180, 90)
path.AddLine(x + r, y, x + w - r, y)

path.CloseFigure()
g.DrawPath(Pens.Red, path)
If you are handling the Paint event, your can get the context from the PaintEventArgs parameters Graphics property. Otherwise you need to create the Graphics object for the item you are drawing onto, and Dispose it when you are finished.
 
Share this answer
 
Comments
sara.solati68 27-Nov-11 9:47am    
You did not solve my problem.
OriginalGriff 27-Nov-11 9:59am    
I looked at you picture - you show a fileld figure, and a non-filled figure. I tested my code, and it produces a non-filled figure. If that is not what you want, then you need to make it clearer. Use the "Improve question" widget to edit your question and provide better information.
sara.solati68 27-Nov-11 13:22pm    
EX me.my bad.I mean is:

how it produces a filled figure.
OriginalGriff 27-Nov-11 15:15pm    
:laugh:
Use FillPath instead of DrawPath, and use a Brush instead of a pen:

g.FillPath(Brushes.Green, path)
sara.solati68 29-Nov-11 13:53pm    
Thank you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900