GraphicsPathIterator.NextPathType メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > GraphicsPathIterator.NextPathType メソッドの意味・解説 

GraphicsPathIterator.NextPathType メソッド

すべてが同じ種類データから成る次のグループ開始インデックス終了インデックス取得します

名前空間: System.Drawing.Drawing2D
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

Public Function NextPathType ( _
    <OutAttribute> ByRef pathType As
 Byte, _
    <OutAttribute> ByRef startIndex As
 Integer, _
    <OutAttribute> ByRef endIndex As
 Integer _
) As Integer
Dim instance As GraphicsPathIterator
Dim pathType As Byte
Dim startIndex As Integer
Dim endIndex As Integer
Dim returnValue As Integer

returnValue = instance.NextPathType(pathType, startIndex, endIndex)
public int NextPathType (
    out byte pathType,
    out int startIndex,
    out int endIndex
)
public:
int NextPathType (
    [OutAttribute] unsigned char% pathType, 
    [OutAttribute] int% startIndex, 
    [OutAttribute] int% endIndex
)
public int NextPathType (
    /** @attribute OutAttribute() */ /** @ref */ byte pathType, 
    /** @attribute OutAttribute() */ /** @ref */ int startIndex,
 
    /** @attribute OutAttribute() */ /** @ref */ int endIndex
)
JScript では、値型引数参照渡しされません。

パラメータ

pathType

[出力] グループすべてのポイント共有されるポイント タイプ受け取ります返される可能性があるタイプは、PathPointType 列挙体から取得できます

startIndex

[出力] ポイント グループ開始インデックス受け取ります

endIndex

[出力] ポイント グループ終了インデックス受け取ります

戻り値
このメソッドは、グループ内のデータ点の数を返しますパスそれ以上グループない場合は、0 を返します

使用例使用例

次の例は、Windows フォームでの使用意図してデザインされており、OnPaint イベントオブジェクトである PaintEventArgse が必要です。このコード次のアクション実行します

ListPathPoints ヘルパ関数であり、すべてではありませんが、ほとんどの表示コードグラフィックス パス コードから切り離します。

Public Sub NextPathTypeExample(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, and an ellipse.
    myPath.AddLines(myPoints)
    myPath.AddRectangle(myRect)
    myPath.AddEllipse(220, 220, 100, 100)

    ' List all of the path points to the screen.
    ListPathPointsHelper(e, myPath, Nothing, 20, 1)

    ' Create a GraphicsPathIterator.
    Dim myPathIterator As New
 GraphicsPathIterator(myPath)

    ' Rewind the Iterator.
    myPathIterator.Rewind()

    ' Iterate the subpaths and types, and list the results
    ' to the screen.
    Dim j As Integer = 20
    Dim i As Integer
    Dim mySubPaths, subPathStartIndex, subPathEndIndex As
 Integer
    Dim IsClosed As [Boolean]
    Dim subPathPointType As Byte
    Dim pointTypeStartIndex, pointTypeEndIndex, _
    numPointsFound As Integer
    Dim myFont As New Font("Arial",
 8)
    Dim myBrush As New SolidBrush(Color.Black)
    j = 20
    For i = 0 To 2
        mySubPaths = myPathIterator.NextSubpath(subPathStartIndex, _
            subPathEndIndex, IsClosed)
        numPointsFound = myPathIterator.NextPathType(subPathPointType, _
            pointTypeStartIndex, pointTypeEndIndex)
        e.Graphics.DrawString("SubPath: " & i
 & "  Points Found: " & _
            numPointsFound.ToString() & "  Type of Points:
 " & _
        subPathPointType.ToString(), myFont, myBrush, 200, j)
        j += 20
    Next i

    ' List the total number of path points to the screen.
    ListPathPointsHelper(e, myPath, myPathIterator, 200, 2)
End Sub

' This is a helper function used by NextPathTypeExample.
Public Sub ListPathPointsHelper(ByVal
 e As PaintEventArgs, _
ByVal myPath As GraphicsPath, ByVal
 myPathIterator As GraphicsPathIterator, _
ByVal xOffset As Integer,
 ByVal listType As Integer)

    ' 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 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)
    If listType = 1 Then
        ' List all the path points to the screen.

        ' 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, xOffset, j)
            j += 20
        Next i
    Else
        If listType = 2 Then
            ' Display the total number of path points.

            ' Draw the total number of points to the screen.
            Dim myPathTotalPoints As Integer
 = myPathIterator.Count
            e.Graphics.DrawString("Total Points = "
 + _
                myPathTotalPoints.ToString(), myFont, myBrush, xOffset, _
                100)
        Else
            e.Graphics.DrawString("Wrong or no list type argument.",
 _
                myFont, myBrush, xOffset, 200)
        End If
    End If
End Sub
public void NextPathTypeExample(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, and an ellipse.
    myPath.AddLines(myPoints);
    myPath.AddRectangle(myRect);
    myPath.AddEllipse(220, 220, 100, 100);
             
    // List all of the path points to the screen.
    ListPathPoints(e, myPath, null, 20, 1);
             
    // Create a GraphicsPathIterator.
    GraphicsPathIterator myPathIterator = new
        GraphicsPathIterator(myPath);
             
    // Rewind the Iterator.
    myPathIterator.Rewind();
             
    // Iterate the subpaths and types, and list the results to
             
    // the screen.
    int i, j = 20;
    int mySubPaths, subPathStartIndex, subPathEndIndex;
    Boolean IsClosed;
    byte subPathPointType;
    int pointTypeStartIndex,  pointTypeEndIndex, numPointsFound;
    Font myFont = new Font("Arial", 8);
    SolidBrush myBrush = new SolidBrush(Color.Black);
    j = 20;
    for(i = 0;i < 3; i++)
    {
        mySubPaths = myPathIterator.NextSubpath(
            out subPathStartIndex,
            out subPathEndIndex,
            out IsClosed);
        numPointsFound = myPathIterator.NextPathType(
            out subPathPointType,
            out pointTypeStartIndex,
            out pointTypeEndIndex);
        e.Graphics.DrawString(
            "SubPath: " + i +
            "  Points Found: " + numPointsFound.ToString() +
            "  Type of Points: " + subPathPointType.ToString(),
            myFont,
            myBrush,
            200,
            j);
        j+=20;
    }
             
    // List the total number of path points to the screen.
    ListPathPoints(e, myPath, myPathIterator, 200, 2);
}
             
//-------------------------------------------------------
//This function is a helper function used by
// NextPathTypeExample.
//-------------------------------------------------------
public void ListPathPoints(
    PaintEventArgs e,
    GraphicsPath myPath,
    GraphicsPathIterator myPathIterator,
    int xOffset,
    int listType)
{
             
    // 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 points to the screen.
    int i;
    float j = 20;
    Font myFont = new Font("Arial", 8);
    SolidBrush myBrush = new SolidBrush(Color.Black);
    if (listType == 1) 
        // List all the path points to the screen.
    {
             
        // 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,
                xOffset,
                j);
            j+=20;
        }
    }
    else if (listType == 2) 
        // Display the total number of path points.
    {
             
        // Draw the total number of points to the screen.
        int myPathTotalPoints = myPathIterator.Count;
        e.Graphics.DrawString("Total Points = " +
            myPathTotalPoints.ToString(),
            myFont,
            myBrush,
            xOffset,
            100);
    }
    else
    {
        e.Graphics.DrawString("Wrong or no list type argument.",
            myFont, myBrush, xOffset, 200);
    }
}
public:
   void NextPathTypeExample( 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, and an ellipse.
      myPath->AddLines( myPoints );
      myPath->AddRectangle( myRect );
      myPath->AddEllipse( 220, 220, 100, 100 );

      // List all of the path points to the screen.
      ListPathPoints( e, myPath, nullptr, 20, 1 );

      // Create a GraphicsPathIterator.
      GraphicsPathIterator^ myPathIterator = gcnew GraphicsPathIterator( myPath );

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

      // Iterate the subpaths and types, and list the results to
      // the screen.
            int i;
      int j = 20;
      int mySubPaths;
      int subPathStartIndex;
      int subPathEndIndex;
      Boolean IsClosed;
      Byte subPathPointType;
      int pointTypeStartIndex;
      int pointTypeEndIndex;
      int numPointsFound;
      System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",8
 );
      SolidBrush^ myBrush = gcnew SolidBrush( Color::Black );
      j = 20;
      for ( i = 0; i < 3; i++ )
      {
         mySubPaths = myPathIterator->NextSubpath( subPathStartIndex, subPathEndIndex,
 IsClosed );
         numPointsFound = myPathIterator->NextPathType( subPathPointType, pointTypeStartIndex,
 pointTypeEndIndex );
         e->Graphics->DrawString( String::Format( "SubPath: {0}  Points
 Found: {1}  Type of Points: {2}", i,
               numPointsFound, subPathPointType ), myFont, myBrush, 200.0f, (float)j
 );
         j += 20;
      }

      // List the total number of path points to the screen.
      ListPathPoints( e, myPath, myPathIterator, 200, 2 );
   }

   //-------------------------------------------------------
   //This function is a helper function used by
   // NextPathTypeExample.
   //-------------------------------------------------------
   void ListPathPoints( PaintEventArgs^ e, GraphicsPath^ myPath,
 GraphicsPathIterator^ myPathIterator, int xOffset, int
 listType )
   {
      // 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 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 );
      if ( listType == 1 )
      {
         // 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, (float)xOffset, (float)j
 );
            j += 20;
         }
      }
      else
      if ( listType == 2 )
      {
         // Draw the total number of points to the screen.
         int myPathTotalPoints = myPathIterator->Count;
         e->Graphics->DrawString( String::Format( "Total Points = {0}",
 myPathTotalPoints ), myFont, myBrush, (float)xOffset, 100.0f
 );
      }
      else
      {
         e->Graphics->DrawString( "Wrong or no list type argument.",
 myFont, myBrush, (float)xOffset, 200.0f );
      }
   }
public void NextPathTypeExample(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, and an ellipse.
    myPath.AddLines(myPoints);
    myPath.AddRectangle(myRect);
    myPath.AddEllipse(220, 220, 100, 100);

    // List all of the path points to the screen.
    ListPathPoints(e, myPath, null, 20, 1);

    // Create a GraphicsPathIterator.
    GraphicsPathIterator myPathIterator = new GraphicsPathIterator(myPath);

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

    // Iterate the subpaths and types, and list the results to
    // the screen.
    int j = 20;
    int i;
    int mySubPaths, subPathStartIndex=0, subPathEndIndex=0;
    boolean IsClosed = false;
    ubyte subPathPointType = 0;
    int pointTypeStartIndex=0, pointTypeEndIndex=0, numPointsFound;
    Font myFont = new Font("Arial", 8);
    SolidBrush myBrush = new SolidBrush(Color.get_Black());

    j = 20;
    for (i = 0; i < 3; i++) {
        mySubPaths = myPathIterator.NextSubpath(subPathStartIndex, 
            subPathEndIndex, IsClosed);
        numPointsFound = myPathIterator.NextPathType(subPathPointType, 
            pointTypeStartIndex, pointTypeEndIndex);
        e.get_Graphics().DrawString("SubPath: " + i + "  Points Found:
 " 
            + System.Convert.ToString(numPointsFound) 
            + "  Type of Points: " 
            + System.Convert.ToString(subPathPointType),
            myFont, myBrush, 200, j);
        j += 20;
    }

    // List the total number of path points to the screen.
    ListPathPoints(e, myPath, myPathIterator, 200, 2);
} //NextPathTypeExample

//-------------------------------------------------------
//This function is a helper function used by
// NextPathTypeExample.
//-------------------------------------------------------
public void ListPathPoints(PaintEventArgs e,
 GraphicsPath myPath, 
    GraphicsPathIterator myPathIterator, int xOffset, int
 listType)
{
    // Get the total number of points for the path,
    // and the arrays of the points and types.
    int myPathPointCount = myPath.get_PointCount();
    PointF myPathPoints[] = myPath.get_PathPoints();
    ubyte myPathTypes[] = myPath.get_PathTypes();

    // Set up variables for drawing the points to the screen.
    int i;
    float j = 20;
    Font myFont = new Font("Arial", 8);
    SolidBrush myBrush = new SolidBrush(Color.get_Black());

    if (listType == 1) {
        // List all the path points to the screen.
        // Draw the set of path points and types to the screen.
        for (i = 0; i < myPathPointCount; i++) {
            e.get_Graphics().DrawString(System.Convert.ToString(
                myPathPoints[i].get_X()) + ", "  
                + System.Convert.ToString(myPathPoints[i].get_Y()) + ", "
  
                + myPathTypes.get_Item(i).ToString(), myFont, myBrush, 
                xOffset, j);
            j += 20;
        }
    }
    else {
        if (listType == 2) {
            // Display the total number of path points.
            // Draw the total number of points to the screen.
            int myPathTotalPoints = myPathIterator.get_Count();

            e.get_Graphics().DrawString("Total Points = " 
                + System.Convert.ToString(myPathTotalPoints), myFont, 
                myBrush, xOffset, 100);
        }
        else {
            e.get_Graphics().DrawString("Wrong or no list type argument.",
 
                myFont, myBrush, xOffset, 200);
        }
    }
} //ListPathPoints
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
GraphicsPathIterator クラス
GraphicsPathIterator メンバ
System.Drawing.Drawing2D 名前空間



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

GraphicsPathIterator.NextPathType メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



GraphicsPathIterator.NextPathType メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS