GraphicsPath.AddRectangles メソッド

定義

パスに一連の四角形を追加します。

オーバーロード

AddRectangles(Rectangle[])

パスに一連の四角形を追加します。

AddRectangles(RectangleF[])

パスに一連の四角形を追加します。

AddRectangles(Rectangle[])

パスに一連の四角形を追加します。

public:
 void AddRectangles(cli::array <System::Drawing::Rectangle> ^ rects);
public void AddRectangles (System.Drawing.Rectangle[] rects);
member this.AddRectangles : System.Drawing.Rectangle[] -> unit
Public Sub AddRectangles (rects As Rectangle())

パラメーター

rects
Rectangle[]

追加する四角形を表す Rectangle 構造体の配列。

次のコード例は、Windows フォームで使用するように設計されており、イベント オブジェクトがOnPaint必要PaintEventArgseです。 コードは、次のアクションを実行します。

  • パスを作成します。

  • 四角形の配列を作成し、パスに四角形を追加します。

  • 画面へのパスを描画します。

private:
   void AddRectanglesExample( PaintEventArgs^ e )
   {
      // Adds a pattern of rectangles to a GraphicsPath object.
      GraphicsPath^ myPath = gcnew GraphicsPath;
      array<Rectangle>^ pathRects = {Rectangle(20,20,100,200),Rectangle(40,40,120,220),Rectangle(60,60,240,140)};
      myPath->AddRectangles( pathRects );

      // Draw the path to the screen.
      Pen^ myPen = gcnew Pen( Color::Black,2.0f );
      e->Graphics->DrawPath( myPen, myPath );
   }
private void AddRectanglesExample(PaintEventArgs e)
{
             
    // Adds a pattern of rectangles to a GraphicsPath object.
    GraphicsPath myPath = new GraphicsPath();
    Rectangle[] pathRects =
             {
                 new Rectangle(20,20,100,200),
                 new Rectangle(40,40,120,220),
                 new Rectangle(60,60,240,140)
             };
    myPath.AddRectangles(pathRects);
             
    // Draw the path to the screen.
    Pen myPen = new Pen(Color.Black, 2);
    e.Graphics.DrawPath(myPen, myPath);
}
Public Sub AddRectanglesExample(ByVal e As PaintEventArgs)

    ' Adds a pattern of rectangles to a GraphicsPath object.
    Dim myPath As New GraphicsPath
    Dim pathRects As Rectangle() = {New Rectangle(20, 20, 100, 200), _
    New Rectangle(40, 40, 120, 220), New Rectangle(60, 60, 240, 140)}
    myPath.AddRectangles(pathRects)

    ' Draw the path to the screen.
    Dim myPen As New Pen(Color.Black, 2)
    e.Graphics.DrawPath(myPen, myPath)
End Sub

適用対象

AddRectangles(RectangleF[])

パスに一連の四角形を追加します。

public:
 void AddRectangles(cli::array <System::Drawing::RectangleF> ^ rects);
public void AddRectangles (System.Drawing.RectangleF[] rects);
member this.AddRectangles : System.Drawing.RectangleF[] -> unit
Public Sub AddRectangles (rects As RectangleF())

パラメーター

rects
RectangleF[]

追加する四角形を表す RectangleF 構造体の配列。

例については、「AddRectangles(Rectangle[])」を参照してください。

適用対象