GraphicsPathIterator.CopyData 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
오버로드
CopyData(PointF[], Byte[], Int32, Int32) |
연결된 GraphicsPathPathPoints 속성 및 PathTypes 속성 배열을 지정된 두 배열에 복사합니다. |
CopyData(Span<PointF>, Span<Byte>, Int32, Int32) |
CopyData(PointF[], Byte[], Int32, Int32)
- Source:
- GraphicsPathIterator.cs
- Source:
- GraphicsPathIterator.cs
- Source:
- GraphicsPathIterator.cs
- Source:
- GraphicsPathIterator.cs
- Source:
- GraphicsPathIterator.cs
연결된 GraphicsPathPathPoints 속성 및 PathTypes 속성 배열을 지정된 두 배열에 복사합니다.
public:
int CopyData(cli::array <System::Drawing::PointF> ^ % points, cli::array <System::Byte> ^ % types, int startIndex, int endIndex);
public int CopyData (ref System.Drawing.PointF[] points, ref byte[] types, int startIndex, int endIndex);
member this.CopyData : PointF[] * Byte[] * int * int -> int
Public Function CopyData (ByRef points As PointF(), ByRef types As Byte(), startIndex As Integer, endIndex As Integer) As Integer
매개 변수
- types
- Byte[]
반환 시 경로의 점 형식을 나타내는 바이트 배열을 포함합니다.
- startIndex
- Int32
배열의 시작 인덱스를 지정합니다.
- endIndex
- Int32
배열의 끝 인덱스를 지정합니다.
반환
복사된 지점 수입니다.
예제
다음 예제는 Windows Forms에서 사용하도록 설계되었으며 OnPaint 이벤트 개체인 PaintEventArgse
필요합니다. 코드는 다음 작업을 수행합니다.
그래픽 경로를 만듭니다.
여러 기본 형식과 일부 표식으로 채웁니다.
화면 왼쪽의 경로 데이터를 나열합니다.
GraphicsPathIterator 만들고 되감습니다.
경로 데이터 인덱스를 두 번째 표식으로 증분합니다.
CopyData 메서드를 호출하여 시작 인덱스와 끝 인덱스 사이에 포함된 경로 데이터를 점 및 형식 배열에 복사합니다.
이 복사한 데이터를 화면 오른쪽에 나열합니다.
public:
void CopyDataExample( PaintEventArgs^ e )
{
// Create a graphics path.
GraphicsPath^ myPath = gcnew GraphicsPath;
// Set up a points array.
array<Point>^ myPoints = {Point(20,20),Point(120,120),Point(20,120),Point(20,20)};
// Create a rectangle.
Rectangle myRect = Rectangle(120,120,100,100);
// Add the points, rectangle, and an ellipse to the path.
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 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.
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 and rewind it.
GraphicsPathIterator^ myPathIterator = gcnew GraphicsPathIterator( myPath );
myPathIterator->Rewind();
// Set up the arrays to receive the copied data.
array<PointF>^points = gcnew array<PointF>(myPathIterator->Count);
array<Byte>^types = gcnew array<Byte>(myPathIterator->Count);
int myStartIndex;
int myEndIndex;
// Increment the starting index to the second marker in the
// path.
myPathIterator->NextMarker( myStartIndex, myEndIndex );
myPathIterator->NextMarker( myStartIndex, myEndIndex );
// Copy all the points and types from the starting index to the
// ending index to the points array and the types array
// respectively.
int numPointsCopied = myPathIterator->CopyData( points, types, myStartIndex, myEndIndex );
// List the copied points to the right side of the screen.
j = 20;
int copiedStartIndex = 0;
for ( i = 0; i < numPointsCopied; i++ )
{
copiedStartIndex = myStartIndex + i;
e->Graphics->DrawString( String::Format( "Point: {0}, Value: {1}, Type: {2}", copiedStartIndex, points[ i ], types[ i ] ), myFont, myBrush, 200, j );
j += 20;
}
}
public void CopyDataExample(PaintEventArgs e)
{
// Create a graphics path.
GraphicsPath myPath = new GraphicsPath();
// Set up a points array.
Point[] myPoints =
{
new Point(20, 20),
new Point(120, 120),
new Point(20, 120),
new Point(20, 20)
};
// Create a rectangle.
Rectangle myRect = new Rectangle(120, 120, 100, 100);
// Add the points, rectangle, and an ellipse to the path.
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 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.
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 and rewind it.
GraphicsPathIterator myPathIterator =
new GraphicsPathIterator(myPath);
myPathIterator.Rewind();
// Set up the arrays to receive the copied data.
PointF[] points = new PointF[myPathIterator.Count];
byte[] types = new byte[myPathIterator.Count];
int myStartIndex;
int myEndIndex;
// Increment the starting index to the second marker in the
// path.
myPathIterator.NextMarker(out myStartIndex, out myEndIndex);
myPathIterator.NextMarker(out myStartIndex, out myEndIndex);
// Copy all the points and types from the starting index to the
// ending index to the points array and the types array
// respectively.
int numPointsCopied = myPathIterator.CopyData(
ref points,
ref types,
myStartIndex,
myEndIndex);
// List the copied points to the right side of the screen.
j = 20;
int copiedStartIndex = 0;
for(i=0; i<numPointsCopied; i++)
{
copiedStartIndex = myStartIndex + i;
e.Graphics.DrawString(
"Point: " + copiedStartIndex.ToString() +
", Value: " + points[i].ToString() +
", Type: " + types[i].ToString(),
myFont,
myBrush,
200,
j);
j+=20;
}
}
Public Sub CopyDataExample(ByVal e As PaintEventArgs)
' Create a graphics path.
Dim myPath As New GraphicsPath
' Set up a points array.
Dim myPoints As Point() = {New Point(20, 20), _
New Point(120, 120), New Point(20, 120), New Point(20, 20)}
' Create a rectangle.
Dim myRect As New Rectangle(120, 120, 100, 100)
' Add the points, rectangle, and an ellipse to the path.
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 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.
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 and rewind it.
Dim myPathIterator As New GraphicsPathIterator(myPath)
myPathIterator.Rewind()
' Set up the arrays to receive the copied data.
Dim points(myPathIterator.Count) As PointF
Dim types(myPathIterator.Count) As Byte
Dim myStartIndex As Integer
Dim myEndIndex As Integer
' Increment the starting index to the second marker in the path.
myPathIterator.NextMarker(myStartIndex, myEndIndex)
myPathIterator.NextMarker(myStartIndex, myEndIndex)
' Copy all the points and types from the starting index to the
' ending index to the points array and the types array
' respectively.
Dim numPointsCopied As Integer = myPathIterator.CopyData(points, _
types, myStartIndex, myEndIndex)
' List the copied points to the right side of the screen.
j = 20
Dim copiedStartIndex As Integer = 0
For i = 0 To numPointsCopied - 1
copiedStartIndex = myStartIndex + i
e.Graphics.DrawString("Point: " + _
copiedStartIndex.ToString() + ", Value: " + _
points(i).ToString() + ", Type: " + types(i).ToString(), _
myFont, myBrush, 200, j)
j += 20
Next i
End Sub
설명
startIndex
및 endIndex
매개 변수를 사용하여 지정된 경로 데이터 범위를 복사합니다.
적용 대상
CopyData(Span<PointF>, Span<Byte>, Int32, Int32)
- Source:
- GraphicsPathIterator.cs
public:
int CopyData(Span<System::Drawing::PointF> points, Span<System::Byte> types, int startIndex, int endIndex);
public int CopyData (Span<System.Drawing.PointF> points, Span<byte> types, int startIndex, int endIndex);
member this.CopyData : Span<System.Drawing.PointF> * Span<byte> * int * int -> int
Public Function CopyData (points As Span(Of PointF), types As Span(Of Byte), startIndex As Integer, endIndex As Integer) As Integer
매개 변수
- startIndex
- Int32
- endIndex
- Int32
반환
적용 대상
.NET