GraphicsPathIterator.NextMarker 메서드

정의

반복기를 경로에 있는 다음 마커로 이동합니다.Moves the iterator to the next marker in the path.

오버로드

NextMarker(GraphicsPath)

GraphicsPathIterator 개체에는 해당 개체와 관련된 GraphicsPath 개체가 있습니다.This GraphicsPathIterator object has a GraphicsPath object associated with it. NextMarker(GraphicsPath) 메서드는 연결된 GraphicsPath를 경로에 있는 다음 마커까지 증가시키고, 현재 마커와 다음 마커(또는 경로 끝) 사이에 있는 모든 지점을 매개 변수에 전달되는 두 번째 GraphicsPath 개체에 복사합니다.The NextMarker(GraphicsPath) method increments the associated GraphicsPath to the next marker in its path and copies all the points contained between the current marker and the next marker (or end of path) to a second GraphicsPath object passed in to the parameter.

NextMarker(Int32, Int32)

GraphicsPathIterator를 경로에 있는 다음 마커까지 증가시키고, [out] 매개 변수를 사용하여 시작 및 중지 인덱스를 반환합니다.Increments the GraphicsPathIterator to the next marker in the path and returns the start and stop indexes by way of the [out] parameters.

NextMarker(GraphicsPath)

GraphicsPathIterator 개체에는 해당 개체와 관련된 GraphicsPath 개체가 있습니다.This GraphicsPathIterator object has a GraphicsPath object associated with it. NextMarker(GraphicsPath) 메서드는 연결된 GraphicsPath를 경로에 있는 다음 마커까지 증가시키고, 현재 마커와 다음 마커(또는 경로 끝) 사이에 있는 모든 지점을 매개 변수에 전달되는 두 번째 GraphicsPath 개체에 복사합니다.The NextMarker(GraphicsPath) method increments the associated GraphicsPath to the next marker in its path and copies all the points contained between the current marker and the next marker (or end of path) to a second GraphicsPath object passed in to the parameter.

public:
 int NextMarker(System::Drawing::Drawing2D::GraphicsPath ^ path);
public int NextMarker (System.Drawing.Drawing2D.GraphicsPath path);
member this.NextMarker : System.Drawing.Drawing2D.GraphicsPath -> int
Public Function NextMarker (path As GraphicsPath) As Integer

매개 변수

path
GraphicsPath

지점이 복사될 GraphicsPath 개체입니다.The GraphicsPath object to which the points will be copied.

반환

이 마커와 다음 마커 사이의 지점 수입니다.The number of points between this marker and the next.

예제

다음 예제는 Windows Forms와 함께 사용 하도록 설계 되었으며 OnPaint 이벤트 개체인 PaintEventArgse필요 합니다.The following example is designed for use with Windows Forms, and it requires PaintEventArgse, an OnPaint event object. 이 코드에서는 다음 작업을 수행합니다.The code performs the following actions:

  • GraphicsPath 개체를 만듭니다.Creates a GraphicsPath object.

  • 세 줄, 사각형, 타원, 및 두 마커를 추가합니다.Adds three lines, a rectangle, an ellipse, and two markers.

  • 화면 왼쪽에 모든 경로 지점의 값을 나열합니다.Lists the values of all the path's points to the left side of the screen.

  • GraphicsPathIterator 개체를 만듭니다.Creates a GraphicsPathIterator object.

  • 복사 된 요소를 받는 myPathSectionGraphicsPath 개체를 만듭니다.Creates a GraphicsPath object, myPathSection, to receive copied points.

  • NextMarker 메서드를 호출 합니다 .이 메서드는 첫 번째 표식을 반복 하 고 해당 표식 사이에 있는 모든 점과 myPathSection옆에 있는 모든 요소를 복사 합니다.Calls the NextMarker method, which iterates to the first marker and copies all the points contained between that marker and the next to myPathSection.

  • markerPoints복사 된 지점의 수를 반환 합니다.Returns the number of points copied to markerPoints.

  • 화면 오른쪽에 포함 된 요소의 수와 표식 수 (첫 번째 마커)를 나열 합니다.Lists the marker number (the first marker) and number of points it contains to the right side of the screen.

public:
   void NextMarkerExample2( 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 the values 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 for all of path points 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.
      GraphicsPathIterator^ myPathIterator = gcnew GraphicsPathIterator( myPath );

      // Rewind the iterator.
      myPathIterator->Rewind();

      // Create a GraphicsPath to receive a section of myPath.
      GraphicsPath^ myPathSection = gcnew GraphicsPath;

      // Retrieve and list the number of points contained in
      // the first marker to the right side of the screen.
      int markerPoints;
      markerPoints = myPathIterator->NextMarker( myPathSection );
      e->Graphics->DrawString( String::Format( "Marker: 1  Num Points: {0}", markerPoints ), myFont, myBrush, 200, 20 );
   }
public void NextMarkerExample2(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 the values 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 for all of path points 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.
    GraphicsPathIterator myPathIterator = new
        GraphicsPathIterator(myPath);
             
    // Rewind the iterator.
    myPathIterator.Rewind();
             
    // Create a GraphicsPath to receive a section of myPath.
    GraphicsPath myPathSection = new GraphicsPath();
             
    // Retrieve and list the number of points contained in
             
    // the first marker to the right side of the screen.
    int markerPoints;
    markerPoints = myPathIterator.NextMarker(myPathSection);
    e.Graphics.DrawString("Marker: 1" + "  Num Points: " +
        markerPoints.ToString(),  myFont, myBrush, 200, 20);
}
Public Sub NextMarkerExample2(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.
    Dim myPathIterator As New GraphicsPathIterator(myPath)

    ' Rewind the iterator.
    myPathIterator.Rewind()

    ' Create a GraphicsPath section.
    Dim myPathSection As New GraphicsPath

    ' List the points contained in the first marker
    ' to the screen.
    Dim markerPoints As Integer
    markerPoints = myPathIterator.NextMarker(myPathSection)
    e.Graphics.DrawString("Marker: 1" + "  Num Points: " + _
        markerPoints.ToString(), myFont, myBrush, 200, 20)
End Sub

설명

SetMarkers 메서드를 사용 하 여 경로에 표식을 설정 합니다.Use the SetMarkers method to set markers in a path. 표식 경로의 하위 그룹을 만드는 데 사용 됩니다.Markers are used to create groups of subpaths. 하나 이상의 하위 경로 두 표식 사이일 수 있습니다.One or more subpaths can be between two markers.

NextMarker(Int32, Int32)

GraphicsPathIterator를 경로에 있는 다음 마커까지 증가시키고, [out] 매개 변수를 사용하여 시작 및 중지 인덱스를 반환합니다.Increments the GraphicsPathIterator to the next marker in the path and returns the start and stop indexes by way of the [out] parameters.

public:
 int NextMarker([Runtime::InteropServices::Out] int % startIndex, [Runtime::InteropServices::Out] int % endIndex);
public int NextMarker (out int startIndex, out int endIndex);
member this.NextMarker : int * int -> int
Public Function NextMarker (ByRef startIndex As Integer, ByRef endIndex As Integer) As Integer

매개 변수

startIndex
Int32

[out] 이 매개 변수에 제공된 정수 참조는 하위 경로를 시작하는 지점의 인덱스를 받습니다.[out] The integer reference supplied to this parameter receives the index of the point that starts a subpath.

endIndex
Int32

[out] 이 매개 변수에 제공된 정수 참조는 startIndex가 가리키는 하위 경로를 끝내는 지점의 인덱스를 받습니다.[out] The integer reference supplied to this parameter receives the index of the point that ends the subpath to which startIndex points.

반환

이 마커와 다음 마커 사이의 지점 수입니다.The number of points between this marker and the next.

예제

다음 예제는 Windows Forms와 함께 사용 하도록 설계 되었으며 OnPaint 이벤트 개체인 PaintEventArgse필요 합니다.The following example is designed for use with Windows Forms, and it requires PaintEventArgse, an OnPaint event object. 이 코드에서는 다음 작업을 수행합니다.The code performs the following actions:

  • GraphicsPath 개체를 만듭니다.Creates a GraphicsPath object.

  • 세 선, 사각형 및 타원 ¾ 표식 사용 하 여 각 사이 추가합니다.Adds three lines, a rectangle, and an ellipse ¾ with markers between each.

  • 화면에 점 배열에 대 한 값을 그립니다.Draws the values for the array of points to the screen.

  • GraphicsPathIterator 개체를 만듭니다.Creates a GraphicsPathIterator object.

  • NextMarker 메서드를 호출합니다.Calls the NextMarker method.

  • NextMarker에 대 한 반복 호출에서 반환 된 값을 사용 하 여 각 표식의 시작 및 중지 위치를 화면에 그립니다.Uses the values returned from the iterative calls to NextMarker to draw the start and stop points for each marker to the screen.

  • 화면에 점의 총 개수에 대 한 값을 그립니다.Draws the value for the total number of points to the screen.

private:
   void NextMarkerExample( 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->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 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;

      // Rewind the Iterator.
      myPathIterator->Rewind();

      // Draw the Markers and their start and end points
      // to the screen.
      j = 20;
      for ( i = 0; i < 3; i++ )
      {
         myPathIterator->NextMarker( myStartIndex, myEndIndex );
         e->Graphics->DrawString( String::Format( "Marker {0}:  Start: {1}  End: {2}", i, myStartIndex, myEndIndex ),
               myFont, myBrush, 200, j );
         j += 20;
      }

      // Draw the total number of points to the screen.
      j += 20;
      int myPathTotalPoints = myPathIterator->Count;
      e->Graphics->DrawString( String::Format( "Total Points = {0}", myPathTotalPoints ), myFont, myBrush, 200, j );
   }
private void NextMarkerExample(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.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 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;
             
    // Rewind the Iterator.
    myPathIterator.Rewind();
             
    // Draw the Markers and their start and end points
             
    // to the screen.
    j=20;
    for(i=0;i<3;i++)
    {
        myPathIterator.NextMarker(out myStartIndex, out myEndIndex);
        e.Graphics.DrawString("Marker " + i.ToString() +
            ":  Start: " + myStartIndex.ToString()+
            "  End: " + myEndIndex.ToString(),
            myFont,
            myBrush,
            200,
            j);
        j += 20;
    }
             
    // Draw the total number of points to the screen.
    j += 20;
    int myPathTotalPoints = myPathIterator.Count;
    e.Graphics.DrawString("Total Points = " +
        myPathTotalPoints.ToString(),
        myFont,
        myBrush,
        200,
        j);
}
Public Sub NextMarkerExample(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.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.
    Dim myPathIterator As New GraphicsPathIterator(myPath)
    Dim myStartIndex As Integer
    Dim myEndIndex As Integer

    ' Rewind the Iterator.
    myPathIterator.Rewind()

    ' Draw the Markers and their start and end points to the screen.
    j = 20
    For i = 0 To 2
        myPathIterator.NextMarker(myStartIndex, myEndIndex)
        e.Graphics.DrawString("Marker " + i.ToString() + _
            ":  Start: " + myStartIndex.ToString() + "  End: " + _
            myEndIndex.ToString(), myFont, myBrush, 200, j)
        j += 20
    Next i

    ' Draw the total number of points to the screen.
    j += 20
    Dim myPathTotalPoints As Integer = myPathIterator.Count
    e.Graphics.DrawString("Total Points = " + _
        myPathTotalPoints.ToString(), myFont, myBrush, 200, j)
End Sub

설명

SetMarkers 메서드를 사용 하 여 경로에 표식을 설정 합니다.Use the SetMarkers method to set markers in a path. 표식 경로의 하위 그룹을 만드는 데 사용 됩니다.Markers are used to create groups of subpaths. 하나 이상의 하위 경로 두 표식 사이일 수 있습니다.One or more subpaths can be between two markers.

적용 대상