次の方法で共有


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

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

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

パラメータ

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

戻り値

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

使用例

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

  • 青いソリッド ブラシを作成します。
  • 3 つの四角形の配列を作成します。
  • 画面の 3 つの四角形領域を塗りつぶします。
 
Public Sub FillRectanglesRectangleF(e As PaintEventArgs)
' Create solid brush.
Dim blueBrush As New SolidBrush(Color.Blue)
' Create array of rectangles.
Dim rects As RectangleF() =  {New RectangleF(0F, 0F, 100F, 200F), _
New RectangleF(100F, 200F, 250F, 50F), _
New RectangleF(300F, 0F, 50F, 100F)}
' Fill rectangles to screen.
e.Graphics.FillRectangles(blueBrush, rects)
End Sub
        
[C#] 
public void FillRectanglesRectangleF(PaintEventArgs e)
{
// Create solid brush.
SolidBrush blueBrush = new SolidBrush(Color.Blue);
// Create array of rectangles.
RectangleF[] rects =
{
new RectangleF(  0.0F,   0.0F, 100.0F, 200.0F),
new RectangleF(100.0F, 200.0F, 250.0F,  50.0F),
new RectangleF(300.0F,   0.0F,  50.0F, 100.0F)
};
// 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 オーバーロードの一覧