次の方法で共有


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

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

Overloads Public Sub FillRectangles( _
   ByVal brush As Brush, _   ByVal rects() As Rectangle _)
[C#]
public void FillRectangles(Brushbrush,Rectangle[] rects);
[C++]
public: void FillRectangles(Brush* brush,Rectanglerects[]);
[JScript]
public function FillRectangles(
   brush : Brush,rects : Rectangle[]);

パラメータ

  • brush
    塗りつぶしの特性を決定する Brush オブジェクト。
  • rects
    塗りつぶす四角形を表す Rectangle 構造体の配列。

戻り値

このメソッドは値を返しません。

使用例

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

  • 青いソリッド ブラシを作成します。
  • 3 つの四角形の配列を作成します。
  • 画面の 3 つの四角形領域を塗りつぶします。
 
Public Sub FillRectanglesRectangle(e As PaintEventArgs)
' Create solid brush.
Dim blueBrush As New SolidBrush(Color.Blue)
' Create array of rectangles.
Dim rects As Rectangle() =  {New Rectangle(0, 0, 100, 200), _
New Rectangle(100, 200, 250, 50), _
New Rectangle(300, 0, 50, 100)}
' Fill rectangles to screen.
e.Graphics.FillRectangles(blueBrush, rects)
End Sub
        
[C#] 
public void FillRectanglesRectangle(PaintEventArgs e)
{
// Create solid brush.
SolidBrush blueBrush = new SolidBrush(Color.Blue);
// Create array of rectangles.
Rectangle[] rects =
{
new Rectangle(  0,   0, 100, 200),
new Rectangle(100, 200, 250,  50),
new Rectangle(300,   0,  50, 100)
};
// Fill rectangles to screen.
e.Graphics.FillRectangles(blueBrush, rects);
}
        

[C++, JScript] C++ および JScript のサンプルはありません。Visual Basic および C# のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

参照

Graphics クラス | Graphics メンバ | System.Drawing 名前空間 | Graphics.FillRectangles オーバーロードの一覧