GraphicsPathIterator.NextSubpath 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
지정된 GraphicsPath하위 경로로 하위 경로를 이동합니다.
오버로드
NextSubpath(GraphicsPath, Boolean) |
이 GraphicsPathIterator연결된 경로에서 다음 그림(하위 경로)을 가져옵니다. |
NextSubpath(Int32, Int32, Boolean) |
GraphicsPathIterator 경로의 다음 하위 경로로 이동합니다. 다음 하위 경로의 시작 인덱스 및 끝 인덱스는 [out] 매개 변수에 포함됩니다. |
NextSubpath(GraphicsPath, Boolean)
- Source:
- GraphicsPathIterator.cs
- Source:
- GraphicsPathIterator.cs
- Source:
- GraphicsPathIterator.cs
- Source:
- GraphicsPathIterator.cs
- Source:
- GraphicsPathIterator.cs
이 GraphicsPathIterator연결된 경로에서 다음 그림(하위 경로)을 가져옵니다.
public:
int NextSubpath(System::Drawing::Drawing2D::GraphicsPath ^ path, [Runtime::InteropServices::Out] bool % isClosed);
public int NextSubpath (System.Drawing.Drawing2D.GraphicsPath path, out bool isClosed);
member this.NextSubpath : System.Drawing.Drawing2D.GraphicsPath * bool -> int
Public Function NextSubpath (path As GraphicsPath, ByRef isClosed As Boolean) As Integer
매개 변수
- path
- GraphicsPath
이 반복기에 대해 검색된 그림(하위 경로)의 데이터 포인트와 일치하도록 데이터 요소를 설정하는 GraphicsPath.
- isClosed
- Boolean
[out] 현재 하위 경로가 닫혀 있는지 여부를 나타냅니다. 그림이 닫혀 있으면 true
, 그렇지 않으면 false
.
반환
검색된 그림(하위 경로)의 데이터 포인트 수입니다. 검색할 수치가 더 이상 없으면 0이 반환됩니다.
예제
다음 예제는 Windows Forms에서 사용하도록 설계되었으며 OnPaint 이벤트 개체인 PaintEventArgse
필요합니다. 코드는 다음 작업을 수행합니다.
GraphicsPath 개체를 만듭니다.
세 줄, 사각형, 타원 및 두 개의 표식을 추가합니다.
화면 왼쪽에 있는 모든 경로 지점의 값을 나열합니다.
GraphicsPathIterator 개체를 만듭니다.
myPathSection
GraphicsPath 개체를 만들어 복사된 지점을 받습니다.세 번째 하위 경로(그림)로 반복하고 해당 하위 경로에 포함된 모든 점을
myPathSection
경로에 복사하는 NextSubpath 메서드를 호출하고subpathPoints
복사된 점 수도 반환합니다.화면 오른쪽에 포함된 하위 경로 번호와 포인트 수를 나열합니다.
void NextSubpathExample2( PaintEventArgs^ e )
{
// Create a graphics path.
GraphicsPath^ myPath = gcnew GraphicsPath;
// Set up primitives to add to myPath.
array<Point>^ myPoints = {Point(20,20),Point(120,120),Point(20,120),Point(20,20)};
Rectangle myRect = 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;
array<PointF>^myPathPoints = myPath->PathPoints;
array<Byte>^myPathTypes = myPath->PathTypes;
// Set up variables for listing all of the path's
// points to 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 values of all the path points and types to 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.
GraphicsPathIterator^ myPathIterator = gcnew GraphicsPathIterator( myPath );
// Rewind the iterator.
myPathIterator->Rewind();
// Create the GraphicsPath section.
GraphicsPath^ myPathSection = gcnew 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, IsClosed2 );
subpathPoints = myPathIterator->NextSubpath( myPathSection, IsClosed2 );
subpathPoints = myPathIterator->NextSubpath( myPathSection, IsClosed2 );
// Write the number of subpath points to the screen.
e->Graphics->DrawString( String::Format( "Subpath: 3 Num Points: {0}", subpathPoints ), myFont, myBrush, 200, 20 );
}
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);
}
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
적용 대상
NextSubpath(Int32, Int32, Boolean)
- Source:
- GraphicsPathIterator.cs
- Source:
- GraphicsPathIterator.cs
- Source:
- GraphicsPathIterator.cs
- Source:
- GraphicsPathIterator.cs
- Source:
- GraphicsPathIterator.cs
GraphicsPathIterator 경로의 다음 하위 경로로 이동합니다. 다음 하위 경로의 시작 인덱스 및 끝 인덱스는 [out] 매개 변수에 포함됩니다.
public:
int NextSubpath([Runtime::InteropServices::Out] int % startIndex, [Runtime::InteropServices::Out] int % endIndex, [Runtime::InteropServices::Out] bool % isClosed);
public int NextSubpath (out int startIndex, out int endIndex, out bool isClosed);
member this.NextSubpath : int * int * bool -> int
Public Function NextSubpath (ByRef startIndex As Integer, ByRef endIndex As Integer, ByRef isClosed As Boolean) As Integer
매개 변수
- startIndex
- Int32
[out] 다음 하위 경로의 시작 인덱스를 받습니다.
- endIndex
- Int32
[out] 다음 하위 경로의 끝 인덱스를 받습니다.
- isClosed
- Boolean
[out] 하위 경로가 닫혀 있는지 여부를 나타냅니다.
반환
GraphicsPath 개체의 하위 경로 수입니다.
예제
다음 예제는 Windows Forms에서 사용하도록 설계되었으며 OnPaint 이벤트 개체인 PaintEventArgse
필요합니다. 코드는 다음 작업을 수행합니다.
GraphicsPath 개체를 만듭니다.
세 줄, 사각형 및 줄임표를 추가합니다.
포인트 배열의 값을 화면에 그립니다.
GraphicsPathIterator 개체를 만듭니다.
NextSubpath 메서드를 호출합니다.
반복 호출에서 반환된 값을 사용하여 NextSubpath 각 하위 경로의 시작 및 중지 값을 화면에 그립니다.
화면에 총 하위 경로 수의 값을 그립니다.
private:
void NextSubpathExample( PaintEventArgs^ e )
{
// Create the GraphicsPath.
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);
// 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;
array<PointF>^myPathPoints = myPath->PathPoints;
array<Byte>^myPathTypes = myPath->PathTypes;
// Set up variables for drawing the array of
// points to the screen.
int i;
float j = 20;
System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",8 );
SolidBrush^ myBrush = gcnew 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 + ", " + myPathPoints[ i ].Y + ", " + myPathTypes[ i ], myFont, myBrush, 20, j );
j += 20;
}
// Create a GraphicsPathIterator.
GraphicsPathIterator^ myPathIterator = gcnew GraphicsPathIterator( myPath );
int myStartIndex;
int myEndIndex;
bool myIsClosed;
// get the number of Subpaths.
int numSubpaths = myPathIterator->NextSubpath( myPath, myIsClosed );
numSubpaths -= 1;
// Rewind the Iterator.
myPathIterator->Rewind();
// List the Subpaths to the screen.
j = 20;
for ( i = 0; i < numSubpaths; i++ )
{
myPathIterator->NextSubpath( myStartIndex, myEndIndex, myIsClosed );
String^ s = String::Format( "Subpath {0}: Start: {1}", i, myStartIndex );
s = s + String::Format( " End: {0} IsClosed: {1}", myEndIndex, myIsClosed );
e->Graphics->DrawString( s, myFont, myBrush, 200, j );
j += 20;
}
// Draw the total number of Subpaths to the screen.
j += 20;
e->Graphics->DrawString( String::Format( "Number Subpaths = {0}", numSubpaths ), myFont, myBrush, 200, j );
}
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);
}
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
적용 대상
.NET