Graphics.DrawRectangles メソッド (Pen, Rectangle )
Rectangle 構造体で指定された一連の四角形を描画します。
Overloads Public Sub DrawRectangles( _
ByVal pen As Pen, _ ByVal rects() As Rectangle _)
[C#]
public void DrawRectangles(Penpen,Rectangle[] rects);
[C++]
public: void DrawRectangles(Pen* pen,Rectanglerects[]);
[JScript]
public function DrawRectangles(
pen : Pen,rects : Rectangle[]);
パラメータ
戻り値
このメソッドは値を返しません。
使用例
[Visual Basic, C#] 次の例は、Windows フォームでの使用を意図してデザインされており、 Paint イベント ハンドラのパラメータである PaintEventArgs e が必要です。このコードは次のアクションを実行します。
- 黒いペンを作成します。
- 3 つの四角形の配列を作成します。
- 画面に四角形を描画します。
Public Sub DrawRectanglesRectangle(e As PaintEventArgs)
' Create pen.
Dim blackPen As New Pen(Color.Black, 3)
' 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)}
' Draw rectangles to screen.
e.Graphics.DrawRectangles(blackPen, rects)
End Sub
[C#]
public void DrawRectanglesRectangle(PaintEventArgs e)
{
// Create pen.
Pen blackPen = new Pen(Color.Black, 3);
// Create array of rectangles.
Rectangle[] rects =
{
new Rectangle( 0, 0, 100, 200),
new Rectangle(100, 200, 250, 50),
new Rectangle(300, 0, 50, 100)
};
// Draw rectangles to screen.
e.Graphics.DrawRectangles(blackPen, 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.DrawRectangles オーバーロードの一覧