本文整理汇总了C#中System.Drawing.Drawing2D.GraphicsPathIterator.NextSubpath方法的典型用法代码示例。如果您正苦于以下问题:C# GraphicsPathIterator.NextSubpath方法的具体用法?C# GraphicsPathIterator.NextSubpath怎么用?C# GraphicsPathIterator.NextSubpath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。
在下文中一共展示了GraphicsPathIterator.NextSubpath方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: NextSubpathExample2
public void NextSubpathExample2(PaintEventArgs e)
{
// Create a graphics path.
GraphicsPath myPath = new GraphicsPath();
// Set up primitives to add to myPath.
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, 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.
int myPathPointCount = myPath.PointCount;
PointF[] myPathPoints = myPath.PathPoints;
byte[] myPathTypes = myPath.PathTypes;
// Set up variables for listing all of the path's
// points to the screen.
int i;
float j = 20;
Font myFont = new Font("Arial", 8);
SolidBrush myBrush = new SolidBrush(Color.Black);
// List the values of all the 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,
20,
j);
j+=20;
}
// Create a GraphicsPathIterator for myPath.
GraphicsPathIterator myPathIterator = new
GraphicsPathIterator(myPath);
// Rewind the iterator.
myPathIterator.Rewind();
// Create the GraphicsPath section.
GraphicsPath myPathSection = new GraphicsPath();
// Iterate to the 3rd subpath and list the number of points therein
// to the screen.
int subpathPoints;
bool IsClosed2;
// Iterate to the third subpath.
subpathPoints = myPathIterator.NextSubpath(
myPathSection, out IsClosed2);
subpathPoints = myPathIterator.NextSubpath(
myPathSection, out IsClosed2);
subpathPoints = myPathIterator.NextSubpath(
myPathSection, out IsClosed2);
// Write the number of subpath points to the screen.
e.Graphics.DrawString("Subpath: 3" +
" Num Points: " +
subpathPoints.ToString(),
myFont,
myBrush,
200,
20);
}
开发者ID:.NET开发者,项目名称:System.Drawing.Drawing2D,代码行数:79,代码来源:GraphicsPathIterator.NextSubpath
示例2: NextSubpathExample
private void NextSubpathExample(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, 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.
int myPathPointCount = myPath.PointCount;
PointF[] myPathPoints = myPath.PathPoints;
byte[] myPathTypes = myPath.PathTypes;
// Set up variables for drawing the array of
// points to the screen.
int i;
float j = 20;
Font myFont = new Font("Arial", 8);
SolidBrush myBrush = new SolidBrush(Color.Black);
// 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,
20,
j);
j+=20;
}
// Create a GraphicsPathIterator.
GraphicsPathIterator myPathIterator = new
GraphicsPathIterator(myPath);
int myStartIndex;
int myEndIndex;
bool myIsClosed;
// get the number of Subpaths.
int numSubpaths = myPathIterator.NextSubpath(myPath,
out myIsClosed);
numSubpaths -= 1;
// Rewind the Iterator.
myPathIterator.Rewind();
// List the Subpaths to the screen.
j=20;
for(i=0;i<numSubpaths;i++)
{
myPathIterator.NextSubpath(out myStartIndex,
out myEndIndex,
out myIsClosed);
e.Graphics.DrawString("Subpath " + i.ToString() +
": Start: " + myStartIndex.ToString()+
" End: " + myEndIndex.ToString() +
" IsClosed: " + myIsClosed.ToString(),
myFont,
myBrush,
200,
j);
j += 20;
}
// Draw the total number of Subpaths to the screen.
j += 20;
e.Graphics.DrawString("Number Subpaths = " +
numSubpaths.ToString(),
myFont,
myBrush,
200,
j);
}
开发者ID:.NET开发者,项目名称:System.Drawing.Drawing2D,代码行数:84,代码来源:GraphicsPathIterator.NextSubpath
注:本文中的System.Drawing.Drawing2D.GraphicsPathIterator.NextSubpath方法示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论