GraphicsPath.AddRectangle メソッド

定義

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

オーバーロード

AddRectangle(RectangleF)

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

AddRectangle(Rectangle)

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

AddRectangle(RectangleF)

ソース:
GraphicsPath.cs
ソース:
GraphicsPath.cs
ソース:
GraphicsPath.cs

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

public:
 void AddRectangle(System::Drawing::RectangleF rect);
public void AddRectangle (System.Drawing.RectangleF rect);
member this.AddRectangle : System.Drawing.RectangleF -> unit
Public Sub AddRectangle (rect As RectangleF)

パラメーター

rect
RectangleF

追加する四角形を表す RectangleF

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

適用対象

AddRectangle(Rectangle)

ソース:
GraphicsPath.cs
ソース:
GraphicsPath.cs
ソース:
GraphicsPath.cs

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

public:
 void AddRectangle(System::Drawing::Rectangle rect);
public void AddRectangle (System.Drawing.Rectangle rect);
member this.AddRectangle : System.Drawing.Rectangle -> unit
Public Sub AddRectangle (rect As Rectangle)

パラメーター

rect
Rectangle

追加する四角形を表す Rectangle

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

  • パスを作成します。

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

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

private:
   void AddRectangleExample( PaintEventArgs^ e )
   {
      // Create a GraphicsPath object and add a rectangle to it.
      GraphicsPath^ myPath = gcnew GraphicsPath;
      Rectangle pathRect = Rectangle(20,20,100,200);
      myPath->AddRectangle( pathRect );

      // Draw the path to the screen.
      Pen^ myPen = gcnew Pen( Color::Black,2.0f );
      e->Graphics->DrawPath( myPen, myPath );
   }
private void AddRectangleExample(PaintEventArgs e)
{
             
    // Create a GraphicsPath object and add a rectangle to it.
    GraphicsPath myPath = new GraphicsPath();
    Rectangle pathRect = new Rectangle(20, 20, 100, 200);
    myPath.AddRectangle(pathRect);
             
    // Draw the path to the screen.
    Pen myPen = new Pen(Color.Black, 2);
    e.Graphics.DrawPath(myPen, myPath);
}
Public Sub AddRectangleExample(ByVal e As PaintEventArgs)

    ' Create a GraphicsPath object and add a rectangle to it.
    Dim myPath As New GraphicsPath
    Dim pathRect As New Rectangle(20, 20, 100, 200)
    myPath.AddRectangle(pathRect)

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

適用対象