Graphics.FillRectangle メソッド

定義

座標ペア、幅、および高さで指定された四角形の内部を塗りつぶします。

オーバーロード

FillRectangle(Brush, Rectangle)

Rectangle 構造体で指定された四角形の内部を塗りつぶします。

FillRectangle(Brush, RectangleF)

RectangleF 構造体で指定された四角形の内部を塗りつぶします。

FillRectangle(Brush, Int32, Int32, Int32, Int32)

座標ペア、幅、および高さで指定された四角形の内部を塗りつぶします。

FillRectangle(Brush, Single, Single, Single, Single)

座標ペア、幅、および高さで指定された四角形の内部を塗りつぶします。

FillRectangle(Brush, Rectangle)

ソース:
Graphics.cs
ソース:
Graphics.cs
ソース:
Graphics.cs

Rectangle 構造体で指定された四角形の内部を塗りつぶします。

public:
 void FillRectangle(System::Drawing::Brush ^ brush, System::Drawing::Rectangle rect);
public void FillRectangle (System.Drawing.Brush brush, System.Drawing.Rectangle rect);
member this.FillRectangle : System.Drawing.Brush * System.Drawing.Rectangle -> unit
Public Sub FillRectangle (brush As Brush, rect As Rectangle)

パラメーター

brush
Brush

塗りつぶしの特性を決定する Brush

rect
Rectangle

塗りつぶす四角形を表す Rectangle 構造体。

例外

brushnullです。

次のコード例は、Windows フォームで使用するように設計されており、イベント ハンドラーのPaintパラメーターである が必要PaintEventArgseです。 このコードでは、次のアクションが実行されます。

  • 単色の青いブラシを作成します。

  • 四角形を作成します。

  • 画面上の四角形の領域を塗りつぶします。

public:
   void FillRectangleRectangle( PaintEventArgs^ e )
   {
      // Create solid brush.
      SolidBrush^ blueBrush = gcnew SolidBrush( Color::Blue );

      // Create rectangle.
      Rectangle rect = Rectangle(0,0,200,200);

      // Fill rectangle to screen.
      e->Graphics->FillRectangle( blueBrush, rect );
   }
private void FillRectangleRectangle(PaintEventArgs e)
{

    // Create solid brush.
    SolidBrush blueBrush = new SolidBrush(Color.Blue);

    // Create rectangle.
    Rectangle rect = new Rectangle(0, 0, 200, 200);

    // Fill rectangle to screen.
    e.Graphics.FillRectangle(blueBrush, rect);
}
Private Sub FillRectangleRectangle(ByVal e As PaintEventArgs)

    ' Create solid brush.
    Dim blueBrush As New SolidBrush(Color.Blue)

    ' Create rectangle.
    Dim rect As New Rectangle(0, 0, 200, 200)

    ' Fill rectangle to screen.
    e.Graphics.FillRectangle(blueBrush, rect)
End Sub

注釈

このメソッドは、 パラメーターで定義された rect 四角形の内部を塗りつぶします。これには、指定した左上隅と計算された下端までが含まれます。

適用対象

FillRectangle(Brush, RectangleF)

ソース:
Graphics.cs
ソース:
Graphics.cs
ソース:
Graphics.cs

RectangleF 構造体で指定された四角形の内部を塗りつぶします。

public:
 void FillRectangle(System::Drawing::Brush ^ brush, System::Drawing::RectangleF rect);
public void FillRectangle (System.Drawing.Brush brush, System.Drawing.RectangleF rect);
member this.FillRectangle : System.Drawing.Brush * System.Drawing.RectangleF -> unit
Public Sub FillRectangle (brush As Brush, rect As RectangleF)

パラメーター

brush
Brush

塗りつぶしの特性を決定する Brush

rect
RectangleF

塗りつぶす四角形を表す RectangleF 構造体。

例外

brushnullです。

次のコード例は、Windows フォームで使用するように設計されており、イベント ハンドラーのPaintパラメーターである が必要PaintEventArgseです。 このコードでは、次のアクションが実行されます。

  • 単色の青いブラシを作成します。

  • 四角形を作成します。

  • 画面上の四角形の領域を塗りつぶします。

public:
   void FillRectangleRectangleF( PaintEventArgs^ e )
   {
      // Create solid brush.
      SolidBrush^ blueBrush = gcnew SolidBrush( Color::Blue );

      // Create rectangle.
      RectangleF rect = RectangleF(0.0F,0.0F,200.0F,200.0F);

      // Fill rectangle to screen.
      e->Graphics->FillRectangle( blueBrush, rect );
   }
private void FillRectangleRectangleF(PaintEventArgs e)
{

    // Create solid brush.
    SolidBrush blueBrush = new SolidBrush(Color.Blue);

    // Create rectangle.
    RectangleF rect = new RectangleF(0.0F, 0.0F, 200.0F, 200.0F);

    // Fill rectangle to screen.
    e.Graphics.FillRectangle(blueBrush, rect);
}
Private Sub FillRectangleRectangleF(ByVal e As PaintEventArgs)

    ' Create solid brush.
    Dim blueBrush As New SolidBrush(Color.Blue)

    ' Create rectangle.
    Dim rect As New RectangleF(0.0F, 0.0F, 200.0F, 200.0F)

    ' Fill rectangle to screen.
    e.Graphics.FillRectangle(blueBrush, rect)
End Sub

注釈

このメソッドは、 パラメーターで定義された rect 四角形の内部を塗りつぶします。これには、指定した左上隅と計算された下端までが含まれます。

適用対象

FillRectangle(Brush, Int32, Int32, Int32, Int32)

ソース:
Graphics.cs
ソース:
Graphics.cs
ソース:
Graphics.cs

座標ペア、幅、および高さで指定された四角形の内部を塗りつぶします。

public:
 void FillRectangle(System::Drawing::Brush ^ brush, int x, int y, int width, int height);
public void FillRectangle (System.Drawing.Brush brush, int x, int y, int width, int height);
member this.FillRectangle : System.Drawing.Brush * int * int * int * int -> unit
Public Sub FillRectangle (brush As Brush, x As Integer, y As Integer, width As Integer, height As Integer)

パラメーター

brush
Brush

塗りつぶしの特性を決定する Brush

x
Int32

塗りつぶす四角形の左上隅の x 座標。

y
Int32

塗りつぶす四角形の左上隅の y 座標。

width
Int32

塗りつぶす四角形の幅。

height
Int32

塗りつぶす四角形の高さ。

例外

brushnullです。

次のコード例は、Windows フォームで使用するように設計されており、イベント ハンドラーのPaintパラメーターである が必要PaintEventArgseです。 このコードでは、次のアクションが実行されます。

  • 単色の青いブラシを作成します。

  • 四角形の位置とサイズを作成します。

  • 画面上の四角形の領域を塗りつぶします。

public:
   void FillRectangleInt( PaintEventArgs^ e )
   {
      // Create solid brush.
      SolidBrush^ blueBrush = gcnew SolidBrush( Color::Blue );

      // Create location and size of rectangle.
      int x = 0;
      int y = 0;
      int width = 200;
      int height = 200;

      // Fill rectangle to screen.
      e->Graphics->FillRectangle( blueBrush, x, y, width, height );
   }
private void FillRectangleInt(PaintEventArgs e)
{

    // Create solid brush.
    SolidBrush blueBrush = new SolidBrush(Color.Blue);

    // Create location and size of rectangle.
    int x = 0;
    int y = 0;
    int width = 200;
    int height = 200;

    // Fill rectangle to screen.
    e.Graphics.FillRectangle(blueBrush, x, y, width, height);
}
Private Sub FillRectangleInt(ByVal e As PaintEventArgs)

    ' Create solid brush.
    Dim blueBrush As New SolidBrush(Color.Blue)

    ' Create location and size of rectangle.
    Dim x As Integer = 0
    Dim y As Integer = 0
    Dim width As Integer = 200
    Dim height As Integer = 200

    ' Fill rectangle to screen.
    e.Graphics.FillRectangle(blueBrush, x, y, width, height)
End Sub

注釈

このメソッドは、指定した左上隅と計算された下端までを含む、 、ywidth、および height パラメーターでx定義された四角形の内部を塗りつぶします。

適用対象

FillRectangle(Brush, Single, Single, Single, Single)

ソース:
Graphics.cs
ソース:
Graphics.cs
ソース:
Graphics.cs

座標ペア、幅、および高さで指定された四角形の内部を塗りつぶします。

public:
 void FillRectangle(System::Drawing::Brush ^ brush, float x, float y, float width, float height);
public void FillRectangle (System.Drawing.Brush brush, float x, float y, float width, float height);
member this.FillRectangle : System.Drawing.Brush * single * single * single * single -> unit
Public Sub FillRectangle (brush As Brush, x As Single, y As Single, width As Single, height As Single)

パラメーター

brush
Brush

塗りつぶしの特性を決定する Brush

x
Single

塗りつぶす四角形の左上隅の x 座標。

y
Single

塗りつぶす四角形の左上隅の y 座標。

width
Single

塗りつぶす四角形の幅。

height
Single

塗りつぶす四角形の高さ。

例外

brushnullです。

次のコード例は、Windows フォームで使用するように設計されており、イベント ハンドラーのPaintパラメーターである が必要PaintEventArgseです。 このコードでは、次のアクションが実行されます。

  • 単色の青いブラシを作成します。

  • 四角形の位置とサイズを作成します。

  • 画面上の四角形の領域を塗りつぶします。

public:
   void FillRectangleFloat( PaintEventArgs^ e )
   {
      // Create solid brush.
      SolidBrush^ blueBrush = gcnew SolidBrush( Color::Blue );

      // Create location and size of rectangle.
      float x = 0.0F;
      float y = 0.0F;
      float width = 200.0F;
      float height = 200.0F;

      // Fill rectangle to screen.
      e->Graphics->FillRectangle( blueBrush, x, y, width, height );
   }
private void FillRectangleFloat(PaintEventArgs e)
{

    // Create solid brush.
    SolidBrush blueBrush = new SolidBrush(Color.Blue);

    // Create location and size of rectangle.
    float x = 0.0F;
    float y = 0.0F;
    float width = 200.0F;
    float height = 200.0F;

    // Fill rectangle to screen.
    e.Graphics.FillRectangle(blueBrush, x, y, width, height);
}
Private Sub FillRectangleFloat(ByVal e As PaintEventArgs)

    ' Create solid brush.
    Dim blueBrush As New SolidBrush(Color.Blue)

    ' Create location and size of rectangle.
    Dim x As Single = 0.0F
    Dim y As Single = 0.0F
    Dim width As Single = 200.0F
    Dim height As Single = 200.0F

    ' Fill rectangle to screen.
    e.Graphics.FillRectangle(blueBrush, x, y, width, height)
End Sub

注釈

このメソッドは、および height パラメーターで定義されたwidthxy四角形の内部を塗りつぶします。これには、指定した左上隅と計算された下端までが含まれます。

適用対象