Use Graphics Path Iterator to get the Path information : Graphics Path Iterator « 2D « VB.Net






Use Graphics Path Iterator to get the Path information

Use Graphics Path Iterator to get the Path information
Imports System
Imports System.Windows.Forms
Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Drawing.Text
Imports System.Drawing.Imaging

Public Class MainClass

  Shared Sub Main()
    Dim p As GraphicsPath = New GraphicsPath()
    Dim pts() As PointF = {New PointF(50.0F, 50.0F), _
                       New PointF(150.0F, 25.0F), _
                       New PointF(200.0F, 50.0F)}
    p.AddCurve(pts)
    p.AddRectangle(New Rectangle(60, 60, 50, 50))
    p.AddPie(100, 100, 80, 80, 0, 35)

    Dim iter As GraphicsPathIterator = New GraphicsPathIterator(p)
    Console.WriteLine("Num pts in path = " & iter.Count.ToString())
    Console.WriteLine("Num subpaths in path = " & iter.SubpathCount.ToString())
    Console.WriteLine("Path has curve = " + iter.HasCurve().ToString())

    Dim StartIndex As Int32
    Dim EndIndex As Int32
    Dim i As Int32
    Dim IsClosed As Boolean
    ' Rewind the Iterator.
    iter.Rewind()
    ' List the Subpaths.
    For i = 0 To iter.SubpathCount - 1
      iter.NextSubpath(StartIndex, EndIndex, IsClosed)
      Console.WriteLine("Start: " + StartIndex.ToString() + _
                         "  End: " + EndIndex.ToString() + _
                         "  IsClosed: " + IsClosed.ToString())
    Next
  End Sub
  
End Class



           
       








Related examples in the same category