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

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

GraphicsPathIterator.CopyData メソッド

GraphicsPath に関連付けられている PathPoints プロパティ配列および PathTypes プロパティ配列を、指定され2 つ配列コピーします

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

Public Function CopyData ( _
    ByRef points As PointF(), _
    ByRef types As Byte(),
 _
    startIndex As Integer, _
    endIndex As Integer _
) As Integer
Dim instance As GraphicsPathIterator
Dim points As PointF()
Dim types As Byte()
Dim startIndex As Integer
Dim endIndex As Integer
Dim returnValue As Integer

returnValue = instance.CopyData(points, types, startIndex, endIndex)
public int CopyData (
    ref PointF[] points,
    ref byte[] types,
    int startIndex,
    int endIndex
)
public:
int CopyData (
    array<PointF>^% points, 
    array<unsigned char>^% types, 
    int startIndex, 
    int endIndex
)
public int CopyData (
    /** @ref */ PointF[] points, 
    /** @ref */ byte[] types, 
    int startIndex, 
    int endIndex
)
JScript では、値型引数参照渡しされません。

パラメータ

points

戻り時にはパス内の点を表す PointF 構造体配列格納されます。

types

戻り時にはパス内の点の種類を表すバイト配列格納されます。

startIndex

配列開始インデックス指定します

endIndex

配列終了インデックス指定します

戻り値
コピーする点の数。

解説解説
使用例使用例

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

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
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:
   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.get_PointCount();
    PointF myPathPoints[] = myPath.get_PathPoints();
    ubyte myPathTypes[] = myPath.get_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.get_Black());

    // List the set of points and types and types to the left side
    // of 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, 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.get_Count()];
    ubyte types[] = new ubyte[myPathIterator.get_Count()];
    int myStartIndex = 0;
    int myEndIndex = 0;

    // 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.get_Graphics().DrawString("Point: " 
            + System.Convert.ToString(copiedStartIndex) + ", Value: "
            + points.get_Item(i).ToString() + ", Type: " 
            + types.get_Item(i).ToString(), myFont, myBrush, 200, j);
        j += 20;
    }
} //CopyDataExample
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
GraphicsPathIterator クラス
GraphicsPathIterator メンバ
System.Drawing.Drawing2D 名前空間


このページでは「.NET Framework クラス ライブラリ リファレンス」からGraphicsPathIterator.CopyData メソッドを検索した結果を表示しています。
Weblioに収録されているすべての辞書からGraphicsPathIterator.CopyData メソッドを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からGraphicsPathIterator.CopyData メソッド を検索

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

辞書ショートカット

すべての辞書の索引

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

   

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



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

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

©2025 GRAS Group, Inc.RSS