座標ペア、幅、および高さで指定された四角形の内部を塗りつぶします。
Overloads Public Sub FillRectangle( _
ByVal brush As Brush, _ ByVal x As Single, _ ByVal y As Single, _ ByVal width As Single, _ ByVal height As Single _)
[C#]
public void FillRectangle(Brushbrush,floatx,floaty,floatwidth,floatheight);
[C++]
public: void FillRectangle(Brush* brush,floatx,floaty,floatwidth,floatheight);
[JScript]
public function FillRectangle(
brush : Brush,x : float,y : float,width : float,height : float);
パラメータ
- brush
塗りつぶしの特性を決定する Brush オブジェクト。 - x
塗りつぶす四角形の左上隅の x 座標。 - y
塗りつぶす四角形の左上隅の y 座標。 - width
塗りつぶす四角形の幅。 - height
塗りつぶす四角形の高さ。
戻り値
このメソッドは値を返しません。
解説
このメソッドは、 x 、 y 、 width 、 height の各パラメータで定義される四角形の内部を塗りつぶします。
使用例
[Visual Basic, C#] 次の例は、Windows フォームでの使用を意図してデザインされており、 Paint イベント ハンドラのパラメータである PaintEventArgs e が必要です。このコードでは次のアクションを実行します。
- 青いソリッド ブラシを作成します。
- 四角形の位置とサイズを作成します。
- 画面の四角形領域を塗りつぶします。
Public Sub FillRectangleFloat(e As PaintEventArgs)
' Create solid brush.
Dim blueBrush As New SolidBrush(Color.Blue)
' Create ___location and size of rectangle.
Dim x As Single = 0F
Dim y As Single = 0F
Dim width As Single = 200F
Dim height As Single = 200F
' Fill rectangle to screen.
e.Graphics.FillRectangle(blueBrush, x, y, width, height)
End Sub
[C#]
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);
}
[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.FillRectangle オーバーロードの一覧