本文整理汇总了VB.NET中System.Drawing.Drawing2D.GraphicsPathIterator.NextSubpath方法的典型用法代码示例。如果您正苦于以下问题:VB.NET GraphicsPathIterator.NextSubpath方法的具体用法?VB.NET GraphicsPathIterator.NextSubpath怎么用?VB.NET GraphicsPathIterator.NextSubpath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Drawing.Drawing2D.GraphicsPathIterator
的用法示例。
在下文中一共展示了GraphicsPathIterator.NextSubpath方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: Point
Public Sub NextSubpathExample2(ByVal e As PaintEventArgs)
' Create a graphics path.
Dim myPath As New GraphicsPath
' Set up primitives to add to myPath.
Dim myPoints As Point() = {New Point(20, 20), _
New Point(120, 120), New Point(20, 120), New Point(20, 20)}
Dim myRect As New Rectangle(120, 120, 100, 100)
' Add 3 lines, a rectangle, an ellipse, and 2 markers.
myPath.AddLines(myPoints)
myPath.SetMarkers()
myPath.AddRectangle(myRect)
myPath.SetMarkers()
myPath.AddEllipse(220, 220, 100, 100)
' Get the total number of points for the path,
' and the arrays of the points and types.
Dim myPathPointCount As Integer = myPath.PointCount
Dim myPathPoints As PointF() = myPath.PathPoints
Dim myPathTypes As Byte() = myPath.PathTypes
' Set up variables for drawing the array
' of points to the screen.
Dim i As Integer
Dim j As Single = 20
Dim myFont As New Font("Arial", 8)
Dim myBrush As New SolidBrush(Color.Black)
' Draw the set of path points and types to the screen.
For i = 0 To myPathPointCount - 1
e.Graphics.DrawString(myPathPoints(i).X.ToString() + _
", " + myPathPoints(i).Y.ToString() + ", " + _
myPathTypes(i).ToString(), myFont, myBrush, 20, j)
j += 20
Next i
' Create a GraphicsPathIterator for myPath.
Dim myPathIterator As New GraphicsPathIterator(myPath)
' Rewind the iterator.
myPathIterator.Rewind()
' Create the GraphicsPath section.
Dim myPathSection As New GraphicsPath
' Draw the 3rd subpath and the number of points therein
' to the screen.
Dim subpathPoints As Integer
Dim IsClosed2 As Boolean
' Iterate to the third subpath.
subpathPoints = myPathIterator.NextSubpath(myPathSection, _
IsClosed2)
subpathPoints = myPathIterator.NextSubpath(myPathSection, _
IsClosed2)
subpathPoints = myPathIterator.NextSubpath(myPathSection, _
IsClosed2)
' Write the number of subpath points to the screen.
e.Graphics.DrawString("Subpath: 3" + " Num Points: " + _
subpathPoints.ToString(), myFont, myBrush, 200, 20)
End Sub
示例2: NextSubpathExample
Public Sub NextSubpathExample(ByVal e As PaintEventArgs)
' Create the GraphicsPath.
Dim myPath As New GraphicsPath
Dim myPoints As Point() = {New Point(20, 20), _
New Point(120, 120), New Point(20, 120), New Point(20, 20)}
Dim myRect As New Rectangle(120, 120, 100, 100)
' Add 3 lines, a rectangle, an ellipse, and 2 markers.
myPath.AddLines(myPoints)
myPath.AddRectangle(myRect)
myPath.AddEllipse(220, 220, 100, 100)
' Get the total number of points for the path,
' and the arrays of the points and types.
Dim myPathPointCount As Integer = myPath.PointCount
Dim myPathPoints As PointF() = myPath.PathPoints
Dim myPathTypes As Byte() = myPath.PathTypes
' Set up variables for drawing the array of points to the screen.
Dim i As Integer
Dim j As Single = 20
Dim myFont As New Font("Arial", 8)
Dim myBrush As New SolidBrush(Color.Black)
' Draw the set of path points and types to the screen.
For i = 0 To myPathPointCount - 1
e.Graphics.DrawString(myPathPoints(i).X.ToString() + ", " + _
myPathPoints(i).Y.ToString() + ", " + _
myPathTypes(i).ToString(), myFont, myBrush, 20, j)
j += 20
Next i
' Create a GraphicsPathIterator.
Dim myPathIterator As New GraphicsPathIterator(myPath)
Dim myStartIndex As Integer
Dim myEndIndex As Integer
Dim myIsClosed As Boolean
' get the number of Subpaths.
Dim numSubpaths As Integer = myPathIterator.NextSubpath(myPath, _
myIsClosed)
numSubpaths -= 1
' Rewind the Iterator.
myPathIterator.Rewind()
' List the Subpaths to the screen.
j = 20
For i = 0 To numSubpaths - 1
myPathIterator.NextSubpath(myStartIndex, myEndIndex, _
myIsClosed)
e.Graphics.DrawString("Subpath " + i.ToString() + _
": Start: " + myStartIndex.ToString() + " End: " + _
myEndIndex.ToString() + " IsClosed: " + _
myIsClosed.ToString(), myFont, myBrush, 200, j)
j += 20
Next i
' Draw the total number of Subpaths to the screen.
j += 20
e.Graphics.DrawString("Number Subpaths = " + _
numSubpaths.ToString(), myFont, myBrush, 200, j)
End Sub