Friday, February 13, 2009

Get the height and width of a polygon or a list of points in array in

When drawing a polygon, I place the points in an array and then draw it out.  However what if you want to know the height and width of your polygon.  One solution is to create a new GraphicsPath object from your array and then use the GetBounds.Width and GetBounds.Height call to get it.

           Dim apolygon As New GraphicsPath
           If (apolygon.GetBounds.Width >= 10 AndAlso apolygon.GetBounds.Height >= 10) Then
                             do something
m_Points is an array of points

No comments: