本文整理汇总了C#中System.Drawing.Drawing2D.GraphicsPathIterator.NextPathType方法的典型用法代码示例。如果您正苦于以下问题:C# GraphicsPathIterator.NextPathType方法的具体用法?C# GraphicsPathIterator.NextPathType怎么用?C# GraphicsPathIterator.NextPathType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。
在下文中一共展示了GraphicsPathIterator.NextPathType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NextPathTypeExample
public void NextPathTypeExample(PaintEventArgs e)
{
// Create the GraphicsPath.
GraphicsPath myPath = new GraphicsPath();
Point[] myPoints = {new Point(20, 20), new Point(120, 120),
new Point(20, 120),new Point(20, 20) };
Rectangle myRect = new Rectangle(120, 120, 100, 100);
// Add 3 lines, a rectangle, and an ellipse.
myPath.AddLines(myPoints);
myPath.AddRectangle(myRect);
myPath.AddEllipse(220, 220, 100, 100);
// List all of the path points to the screen.
ListPathPoints(e, myPath, null, 20, 1);
// Create a GraphicsPathIterator.
GraphicsPathIterator myPathIterator = new
GraphicsPathIterator(myPath);
// Rewind the Iterator.
myPathIterator.Rewind();
// Iterate the subpaths and types, and list the results to
// the screen.
int i, j = 20;
int mySubPaths, subPathStartIndex, subPathEndIndex;
Boolean IsClosed;
byte subPathPointType;
int pointTypeStartIndex, pointTypeEndIndex, numPointsFound;
Font myFont = new Font("Arial", 8);
SolidBrush myBrush = new SolidBrush(Color.Black);
j = 20;
for(i = 0;i < 3; i++)
{
mySubPaths = myPathIterator.NextSubpath(
out subPathStartIndex,
out subPathEndIndex,
out IsClosed);
numPointsFound = myPathIterator.NextPathType(
out subPathPointType,
out pointTypeStartIndex,
out pointTypeEndIndex);
e.Graphics.DrawString(
"SubPath: " + i +
" Points Found: " + numPointsFound.ToString() +
" Type of Points: " + subPathPointType.ToString(),
myFont,
myBrush,
200,
j);
j+=20;
}
// List the total number of path points to the screen.
ListPathPoints(e, myPath, myPathIterator, 200, 2);
}
//-------------------------------------------------------
//This function is a helper function used by
// NextPathTypeExample.
//-------------------------------------------------------
public void ListPathPoints(
PaintEventArgs e,
GraphicsPath myPath,
GraphicsPathIterator myPathIterator,
int xOffset,
int listType)
{
// Get the total number of points for the path,
// and the arrays of the points and types.
int myPathPointCount = myPath.PointCount;
PointF[] myPathPoints = myPath.PathPoints;
byte[] myPathTypes = myPath.PathTypes;
// Set up variables for drawing the points to the screen.
int i;
float j = 20;
Font myFont = new Font("Arial", 8);
SolidBrush myBrush = new SolidBrush(Color.Black);
if (listType == 1)
// List all the path points to the screen.
{
// Draw the set of path points and types to the screen.
for(i=0; i<myPathPointCount; i++)
{
e.Graphics.DrawString(myPathPoints[i].X.ToString()+
", " + myPathPoints[i].Y.ToString() + ", " +
myPathTypes[i].ToString(),
myFont,
myBrush,
xOffset,
j);
j+=20;
}
}
else if (listType == 2)
// Display the total number of path points.
{
// Draw the total number of points to the screen.
int myPathTotalPoints = myPathIterator.Count;
e.Graphics.DrawString("Total Points = " +
myPathTotalPoints.ToString(),
myFont,
myBrush,
xOffset,
100);
}
else
{
e.Graphics.DrawString("Wrong or no list type argument.",
myFont, myBrush, xOffset, 200);
}
}