Hi all!.
It exists a tool that gives the values of points to draw a Polygon? I want to draw a Triangle with the middle point facing to the bottom.
And I wanna know how can I set coordinates to tell draw Polygon in which area of the canvas draw that polygon.
Regards
Graphics.DrawPolygon is used to draw a polygon. You just have to populate an array with the points as described on the doc page. To do a triangle with the middle point facing down, put this code in a Canvas.Paint event handler:
Dim points(6) As Integer
points(1) = 40 // First Point X = 40
points(2) = 10 // First Point Y = 10
points(3) = 100 // Second Point X = 100
points(4) = 10 // Second Point Y = 10
points(5) = (points(1) + points(3)) / 2 // Second Point X = center of Point 1 X and Point 2 X
points(6) = 50 // Third Point Y = 50
g.DrawPolygon(points)
[quote=209873:@Paul Lefebvre]Graphics.DrawPolygon is used to draw a polygon. You just have to populate an array with the points as described on the doc page. To do a triangle with the middle point facing down, put this code in a Canvas.Paint event handler:
Dim points(6) As Integer
points(1) = 40 // First Point X = 40
points(2) = 10 // First Point Y = 10
points(3) = 100 // Second Point X = 100
points(4) = 10 // Second Point Y = 10
points(5) = (points(1) + points(3)) / 2 // Second Point X = center of Point 1 X and Point 2 X
points(6) = 50 // Third Point Y = 50
g.DrawPolygon(points)
[/quote]
Thanks man! But how can I tell where to draw the polygon in coordinates?
No, Wait I get it. What I need is to find a way to follow X and Y with a Variable in order to redraw it If my canvas change.
So, If I set a fixed value for X and Y It will not change of position
Yes, sounds like you’ve got it.