GraphicsPathIterator.Enumerate Metod
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Överlagringar
| Name | Description |
|---|---|
| Enumerate(PointF[], Byte[]) |
Kopierar PathPoints egenskapen och PathTypes egenskapsmatriserna för de associerade GraphicsPath till de två angivna matriserna. |
| Enumerate(Span<PointF>, Span<Byte>) |
Kopierar PathPoints egenskapen och PathTypes egenskapsmatriserna för de associerade GraphicsPath till de två angivna matriserna. |
Enumerate(PointF[], Byte[])
- Källa:
- GraphicsPathIterator.cs
- Källa:
- GraphicsPathIterator.cs
- Källa:
- GraphicsPathIterator.cs
- Källa:
- GraphicsPathIterator.cs
- Källa:
- GraphicsPathIterator.cs
- Källa:
- GraphicsPathIterator.cs
- Källa:
- GraphicsPathIterator.cs
- Källa:
- GraphicsPathIterator.cs
Kopierar PathPoints egenskapen och PathTypes egenskapsmatriserna för de associerade GraphicsPath till de två angivna matriserna.
public:
int Enumerate(cli::array <System::Drawing::PointF> ^ % points, cli::array <System::Byte> ^ % types);
public int Enumerate(ref System.Drawing.PointF[] points, ref byte[] types);
member this.Enumerate : PointF[] * Byte[] -> int
Public Function Enumerate (ByRef points As PointF(), ByRef types As Byte()) As Integer
Parametrar
- points
- PointF[]
Vid retur innehåller en matris med PointF strukturer som representerar punkterna i sökvägen.
- types
- Byte[]
Vid retur innehåller en matris med byte som representerar typerna av punkter i sökvägen.
Returer
Antalet kopierade punkter.
Exempel
Följande exempel är utformat för användning med Windows Forms och kräver PaintEventArgse, ett OnPaint händelseobjekt. Koden utför följande åtgärder:
Skapar en grafiksökväg.
Fyller den med flera primitiver och några markörer.
Visar sökvägsdata till vänster på skärmen.
Skapar en GraphicsPathIterator och spolar tillbaka den.
Ökar sökvägsdataindexet till den andra markören.
Enumerate Anropar metoden för att kopiera sökvägsdata till matriserna
pointsochtypes.Visar en lista över kopierade data till höger på skärmen.
public:
void EnumerateExample( PaintEventArgs^ e )
{
GraphicsPath^ myPath = gcnew GraphicsPath;
array<Point>^ myPoints = {Point(20,20),Point(120,120),Point(20,120),Point(20,20)};
Rectangle myRect = Rectangle(120,120,100,100);
myPath->AddLines( myPoints );
myPath->AddRectangle( myRect );
myPath->AddEllipse( 220, 220, 100, 100 );
// Get the total number of points for the path, and arrays of
// the points and types.
int myPathPointCount = myPath->PointCount;
array<PointF>^myPathPoints = myPath->PathPoints;
array<Byte>^myPathTypes = myPath->PathTypes;
// Set up variables for listing the array of points on the left
// side of the screen.
int i;
float j = 20;
System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",8 );
SolidBrush^ myBrush = gcnew SolidBrush( Color::Black );
// List the set of points and types and types to the left side
// of the screen.
e->Graphics->DrawString( "Original Data", myFont, myBrush, 20, j );
j += 20;
for ( i = 0; i < myPathPointCount; i++ )
{
e->Graphics->DrawString( myPathPoints[ i ].X + ", " + myPathPoints[ i ].Y + ", " + myPathTypes[ i ], myFont, myBrush, 20, j );
j += 20;
}
// Create a GraphicsPathIterator for myPath.
GraphicsPathIterator^ myPathIterator = gcnew GraphicsPathIterator( myPath );
myPathIterator->Rewind();
array<PointF>^points = gcnew array<PointF>(myPathIterator->Count);
array<Byte>^types = gcnew array<Byte>(myPathIterator->Count);
// int numPoints = myPathIterator->Enumerate(&points, &types);
// Draw the set of copied points and types to the screen.
j = 20;
e->Graphics->DrawString( "Copied Data", myFont, myBrush, 200, j );
j += 20;
for ( i = 0; i < points->Length; i++ )
{
e->Graphics->DrawString( String::Format( "Point: {0}, Value: {1}, Type: {2}", i, points[ i ], types[ i ] ), myFont, myBrush, 200, j );
j += 20;
}
}
public void EnumerateExample(PaintEventArgs e)
{
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);
myPath.AddLines(myPoints);
myPath.AddRectangle(myRect);
myPath.AddEllipse(220, 220, 100, 100);
// Get the total number of points for the path, and arrays of
// the points and types.
int myPathPointCount = myPath.PointCount;
PointF[] myPathPoints = myPath.PathPoints;
byte[] myPathTypes = myPath.PathTypes;
// Set up variables for listing the array of points on the left
// side of the screen.
int i;
float j = 20;
Font myFont = new Font("Arial", 8);
SolidBrush myBrush = new SolidBrush(Color.Black);
// List the set of points and types and types to the left side
// of the screen.
e.Graphics.DrawString("Original Data",
myFont,
myBrush,
20,
j);
j += 20;
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);
myPathIterator.Rewind();
PointF[] points = new PointF[myPathIterator.Count];
byte[] types = new byte[myPathIterator.Count];
int numPoints = myPathIterator.Enumerate(ref points, ref types);
// Draw the set of copied points and types to the screen.
j = 20;
e.Graphics.DrawString("Copied Data",
myFont,
myBrush,
200,
j);
j += 20;
for(i=0; i<points.Length; i++)
{
e.Graphics.DrawString("Point: " + i +
", " + "Value: " + points[i].ToString() + ", " +
"Type: " + types[i].ToString(),
myFont,
myBrush,
200,
j);
j+=20;
}
}
Public Sub EnumerateExample(ByVal e As PaintEventArgs)
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)
myPath.AddLines(myPoints)
myPath.AddRectangle(myRect)
myPath.AddEllipse(220, 220, 100, 100)
' Get the total number of points for the path, and 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 listing the array of points on the left side
' of 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)
' List the set of points and types and types to the left side of
' the screen.
e.Graphics.DrawString("Original Data", myFont, myBrush, 20, j)
j += 20
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)
myPathIterator.Rewind()
Dim points(myPathIterator.Count) As PointF
Dim types(myPathIterator.Count) As Byte
Dim numPoints As Integer = myPathIterator.Enumerate(points, types)
' Draw the set of copied points and types to the screen.
j = 20
e.Graphics.DrawString("Copied Data", myFont, myBrush, 200, j)
j += 20
For i = 0 To points.Length - 1
e.Graphics.DrawString("Point: " & i & ", " & "Value: " & _
points(i).ToString() & ", " & "Type: " & _
types(i).ToString(), myFont, myBrush, 200, j)
j += 20
Next i
End Sub
Gäller för
Enumerate(Span<PointF>, Span<Byte>)
- Källa:
- GraphicsPathIterator.cs
- Källa:
- GraphicsPathIterator.cs
- Källa:
- GraphicsPathIterator.cs
- Källa:
- GraphicsPathIterator.cs
- Källa:
- GraphicsPathIterator.cs
Kopierar PathPoints egenskapen och PathTypes egenskapsmatriserna för de associerade GraphicsPath till de två angivna matriserna.
public:
int Enumerate(Span<System::Drawing::PointF> points, Span<System::Byte> types);
public int Enumerate(Span<System.Drawing.PointF> points, Span<byte> types);
member this.Enumerate : Span<System.Drawing.PointF> * Span<byte> -> int
Public Function Enumerate (points As Span(Of PointF), types As Span(Of Byte)) As Integer
Parametrar
Vid retur innehåller en matris med PointF strukturer som representerar punkterna i sökvägen.
Vid retur innehåller en matris med byte som representerar typerna av punkter i sökvägen.
Returer
Antalet kopierade punkter.