GraphicsPathIterator.NextMarker 메서드

정의

반복기를 경로에 있는 다음 마커로 이동합니다.

오버로드

NextMarker(GraphicsPath)

GraphicsPathIterator 개체에는 해당 개체와 관련된 GraphicsPath 개체가 있습니다. NextMarker(GraphicsPath) 메서드는 연결된 GraphicsPath를 경로에 있는 다음 마커까지 증가시키고, 현재 마커와 다음 마커(또는 경로 끝) 사이에 있는 모든 지점을 매개 변수에 전달되는 두 번째 GraphicsPath 개체에 복사합니다.

NextMarker(Int32, Int32)

GraphicsPathIterator를 경로에 있는 다음 마커까지 증가시키고, [out] 매개 변수를 사용하여 시작 및 중지 인덱스를 반환합니다.

NextMarker(GraphicsPath)

Source:
GraphicsPathIterator.cs
Source:
GraphicsPathIterator.cs
Source:
GraphicsPathIterator.cs

GraphicsPathIterator 개체에는 해당 개체와 관련된 GraphicsPath 개체가 있습니다. NextMarker(GraphicsPath) 메서드는 연결된 GraphicsPath를 경로에 있는 다음 마커까지 증가시키고, 현재 마커와 다음 마커(또는 경로 끝) 사이에 있는 모든 지점을 매개 변수에 전달되는 두 번째 GraphicsPath 개체에 복사합니다.

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 개체입니다.

반환

이 마커와 다음 마커 사이의 지점 수입니다.

예제

다음 예제는 Windows Forms 사용하도록 설계되었으며 이벤트 개체인 이 OnPaint 필요합니다PaintEventArgse. 코드는 다음 작업을 수행합니다.

  • GraphicsPath 개체를 만듭니다.

  • 세 줄, 사각형, 타원 및 두 개의 표식을 추가합니다.

  • 모든 경로의 값을 화면 왼쪽에 Lists.

  • GraphicsPathIterator 개체를 만듭니다.

  • 복사된 GraphicsPath 지점을 수신하는 개체 를 myPathSection만듭니다.

  • 메서드를 NextMarker 호출하여 첫 번째 표식으로 반복하고 해당 표식과 다음 myPathSection표식 사이에 포함된 모든 점을 복사합니다.

  • 에 복사된 포인트 수를 반환합니다 markerPoints.

  • 표식 번호(첫 번째 표식) 및 표식이 포함된 점 수를 화면 오른쪽에 Lists.

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 사용하여 경로에 표식을 설정합니다. 표식은 하위 경로 그룹을 만드는 데 사용됩니다. 하나 이상의 하위 경로는 두 표식 사이에 있을 수 있습니다.

적용 대상

NextMarker(Int32, Int32)

Source:
GraphicsPathIterator.cs
Source:
GraphicsPathIterator.cs
Source:
GraphicsPathIterator.cs

GraphicsPathIterator를 경로에 있는 다음 마커까지 증가시키고, [out] 매개 변수를 사용하여 시작 및 중지 인덱스를 반환합니다.

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] 이 매개 변수에 제공된 정수 참조는 하위 경로를 시작하는 지점의 인덱스를 받습니다.

endIndex
Int32

[out] 이 매개 변수에 제공된 정수 참조는 startIndex가 가리키는 하위 경로를 끝내는 지점의 인덱스를 받습니다.

반환

이 마커와 다음 마커 사이의 지점 수입니다.

예제

다음 예제는 Windows Forms 사용하도록 설계되었으며 이벤트 개체인 이 OnPaint 필요합니다PaintEventArgse. 코드는 다음 작업을 수행합니다.

  • GraphicsPath 개체를 만듭니다.

  • 각 줄 사이에 표식이 있는 줄임표 3/4와 직사각형, 타원 3/4를 추가합니다.

  • 화면에 점 배열의 값을 그립니다.

  • GraphicsPathIterator 개체를 만듭니다.

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

  • 반복 호출 NextMarker 에서 반환된 값을 사용하여 각 표식의 시작점과 중지점을 화면에 그립니다.

  • 화면에 총 점 수의 값을 그립니다.

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 사용하여 경로에 표식을 설정합니다. 표식은 하위 경로 그룹을 만드는 데 사용됩니다. 하나 이상의 하위 경로는 두 표식 사이에 있을 수 있습니다.

적용 대상