Graphics.FillRectangleとは? わかりやすく解説

Graphics.FillRectangle メソッド (Brush, RectangleF)

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

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

Public Sub FillRectangle ( _
    brush As Brush, _
    rect As RectangleF _
)
Dim instance As Graphics
Dim brush As Brush
Dim rect As RectangleF

instance.FillRectangle(brush, rect)
public void FillRectangle (
    Brush brush,
    RectangleF rect
)
public:
void FillRectangle (
    Brush^ brush, 
    RectangleF rect
)
public void FillRectangle (
    Brush brush, 
    RectangleF rect
)
public function FillRectangle (
    brush : Brush, 
    rect : RectangleF
)

パラメータ

brush

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

rect

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

例外例外
例外の種類条件

ArgumentNullException

brush が null 参照 (Visual Basic では Nothing) です。

解説解説
使用例使用例

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

Public 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
public 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);
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Graphics.FillRectangle メソッド (Brush, Single, Single, Single, Single)

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

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

例外例外
例外の種類条件

ArgumentNullException

brush が null 参照 (Visual Basic では Nothing) です。

解説解説
使用例使用例

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

Public 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
public 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);
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Graphics.FillRectangle メソッド (Brush, Int32, Int32, Int32, Int32)

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

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

例外例外
例外の種類条件

ArgumentNullException

brush が null 参照 (Visual Basic では Nothing) です。

解説解説
使用例使用例

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

Public 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
public 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);
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Graphics.FillRectangle メソッド

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

名前 説明
Graphics.FillRectangle (Brush, Rectangle) Rectangle 構造体で指定された四角形の内部を塗りつぶします。

.NET Compact Framework によってサポートされています。

Graphics.FillRectangle (Brush, RectangleF) RectangleF 構造体で指定された四角形の内部を塗りつぶします。
Graphics.FillRectangle (Brush, Int32, Int32, Int32, Int32) 座標ペア、幅、および高さで指定された四角形の内部を塗りつぶします。

.NET Compact Framework によってサポートされています。

Graphics.FillRectangle (Brush, Single, Single, Single, Single) 座標ペア、幅、および高さで指定された四角形の内部を塗りつぶします。
参照参照

Graphics.FillRectangle メソッド (Brush, Rectangle)

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

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

Public Sub FillRectangle ( _
    brush As Brush, _
    rect As Rectangle _
)
Dim instance As Graphics
Dim brush As Brush
Dim rect As Rectangle

instance.FillRectangle(brush, rect)
public void FillRectangle (
    Brush brush,
    Rectangle rect
)
public:
void FillRectangle (
    Brush^ brush, 
    Rectangle rect
)
public void FillRectangle (
    Brush brush, 
    Rectangle rect
)
public function FillRectangle (
    brush : Brush, 
    rect : Rectangle
)

パラメータ

brush

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

rect

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

例外例外
例外の種類条件

ArgumentNullException

brush が null 参照 (Visual Basic では Nothing) です。

解説解説
使用例使用例

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

Public 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
public 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);
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳

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

辞書ショートカット

すべての辞書の索引

「Graphics.FillRectangle」の関連用語

Graphics.FillRectangleのお隣キーワード

   

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



Graphics.FillRectangleのページの著作権

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

©2026 GRAS Group, Inc.RSS