Aracılığıyla paylaş


Graphics.DrawRectangles Yöntem

Tanım

Rectangle yapıları tarafından belirtilen bir dizi dikdörtgen çizer.

Aşırı Yüklemeler

DrawRectangles(Pen, Rectangle[])

Rectangle yapıları tarafından belirtilen bir dizi dikdörtgen çizer.

DrawRectangles(Pen, RectangleF[])

RectangleF yapıları tarafından belirtilen bir dizi dikdörtgen çizer.

DrawRectangles(Pen, ReadOnlySpan<Rectangle>)
DrawRectangles(Pen, ReadOnlySpan<RectangleF>)

DrawRectangles(Pen, Rectangle[])

Kaynak:
Graphics.cs
Kaynak:
Graphics.cs
Kaynak:
Graphics.cs
Kaynak:
Graphics.cs
Kaynak:
Graphics.cs

Rectangle yapıları tarafından belirtilen bir dizi dikdörtgen çizer.

public:
 void DrawRectangles(System::Drawing::Pen ^ pen, cli::array <System::Drawing::Rectangle> ^ rects);
public:
 void DrawRectangles(System::Drawing::Pen ^ pen, ... cli::array <System::Drawing::Rectangle> ^ rects);
public void DrawRectangles (System.Drawing.Pen pen, System.Drawing.Rectangle[] rects);
public void DrawRectangles (System.Drawing.Pen pen, params System.Drawing.Rectangle[] rects);
member this.DrawRectangles : System.Drawing.Pen * System.Drawing.Rectangle[] -> unit
Public Sub DrawRectangles (pen As Pen, rects As Rectangle())
Public Sub DrawRectangles (pen As Pen, ParamArray rects As Rectangle())

Parametreler

pen
Pen

Dikdörtgenlerin ana hatlarının rengini, genişliğini ve stilini belirleyen Pen.

rects
Rectangle[]

Çizecek dikdörtgenleri temsil eden Rectangle yapıları dizisi.

Özel durumlar

pen null.

-veya-

rects null.

rects sıfır uzunlukta bir dizidir.

Örnekler

Aşağıdaki kod örneği Windows Forms ile kullanılmak üzere tasarlanmıştır ve Paint olay işleyicisinin bir parametresi olan PaintEventArgsegerektirir. Kod aşağıdaki eylemleri gerçekleştirir:

  • Siyah kalem oluşturur.

  • Üç dikdörtgenden oluşan bir dizi oluşturur.

  • Dikdörtgenleri ekrana çizer.

public:
   void DrawRectanglesRectangle( PaintEventArgs^ e )
   {
      // Create pen.
      Pen^ blackPen = gcnew Pen( Color::Black,3.0f );

      // Create array of rectangles.
      array<Rectangle>^ rects = {Rectangle(0,0,100,200),Rectangle(100,200,250,50),Rectangle(300,0,50,100)};

      // Draw rectangles to screen.
      e->Graphics->DrawRectangles( blackPen, rects );
   }
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);
}
Public Sub DrawRectanglesRectangle(ByVal 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

Şunlara uygulanır

DrawRectangles(Pen, RectangleF[])

Kaynak:
Graphics.cs
Kaynak:
Graphics.cs
Kaynak:
Graphics.cs
Kaynak:
Graphics.cs
Kaynak:
Graphics.cs

RectangleF yapıları tarafından belirtilen bir dizi dikdörtgen çizer.

public:
 void DrawRectangles(System::Drawing::Pen ^ pen, cli::array <System::Drawing::RectangleF> ^ rects);
public:
 void DrawRectangles(System::Drawing::Pen ^ pen, ... cli::array <System::Drawing::RectangleF> ^ rects);
public void DrawRectangles (System.Drawing.Pen pen, System.Drawing.RectangleF[] rects);
public void DrawRectangles (System.Drawing.Pen pen, params System.Drawing.RectangleF[] rects);
member this.DrawRectangles : System.Drawing.Pen * System.Drawing.RectangleF[] -> unit
Public Sub DrawRectangles (pen As Pen, rects As RectangleF())
Public Sub DrawRectangles (pen As Pen, ParamArray rects As RectangleF())

Parametreler

pen
Pen

Dikdörtgenlerin ana hatlarının rengini, genişliğini ve stilini belirleyen Pen.

rects
RectangleF[]

Çizecek dikdörtgenleri temsil eden RectangleF yapıları dizisi.

Özel durumlar

pen null.

-veya-

rects null.

rects sıfır uzunlukta bir dizidir.

Örnekler

Aşağıdaki kod örneği Windows Forms ile kullanılmak üzere tasarlanmıştır ve Paint olay işleyicisinin bir parametresi olan PaintEventArgsegerektirir. Kod aşağıdaki eylemleri gerçekleştirir:

  • Siyah kalem oluşturur.

  • Üç dikdörtgenden oluşan bir dizi oluşturur.

  • Dikdörtgenleri ekrana çizer.

public:
   void DrawRectanglesRectangleF( PaintEventArgs^ e )
   {
      // Create pen.
      Pen^ blackPen = gcnew Pen( Color::Black,3.0f );

      // Create array of rectangles.
      array<RectangleF>^ rects = {RectangleF(0.0F,0.0F,100.0F,200.0F),RectangleF(100.0F,200.0F,250.0F,50.0F),RectangleF(300.0F,0.0F,50.0F,100.0F)};

      // Draw rectangles to screen.
      e->Graphics->DrawRectangles( blackPen, rects );
   }
public void DrawRectanglesRectangleF(PaintEventArgs e)
{
             
    // Create pen.
    Pen blackPen = new Pen(Color.Black, 3);
             
    // 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)
             };
             
    // Draw rectangles to screen.
    e.Graphics.DrawRectangles(blackPen, rects);
}
Public Sub DrawRectanglesRectangleF(ByVal e As PaintEventArgs)

    ' Create pen.
    Dim blackPen As New Pen(Color.Black, 3)

    ' Create array of rectangles.
    Dim rects As RectangleF() = {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)}

    ' Draw rectangles to screen.
    e.Graphics.DrawRectangles(blackPen, rects)
End Sub

Şunlara uygulanır

DrawRectangles(Pen, ReadOnlySpan<Rectangle>)

Kaynak:
Graphics.cs
Kaynak:
Graphics.cs
public:
 void DrawRectangles(System::Drawing::Pen ^ pen, ReadOnlySpan<System::Drawing::Rectangle> rects);
public void DrawRectangles (System.Drawing.Pen pen, scoped ReadOnlySpan<System.Drawing.Rectangle> rects);
member this.DrawRectangles : System.Drawing.Pen * ReadOnlySpan<System.Drawing.Rectangle> -> unit
Public Sub DrawRectangles (pen As Pen, rects As ReadOnlySpan(Of Rectangle))

Parametreler

pen
Pen

Şunlara uygulanır

DrawRectangles(Pen, ReadOnlySpan<RectangleF>)

Kaynak:
Graphics.cs
Kaynak:
Graphics.cs
public:
 void DrawRectangles(System::Drawing::Pen ^ pen, ReadOnlySpan<System::Drawing::RectangleF> rects);
public void DrawRectangles (System.Drawing.Pen pen, scoped ReadOnlySpan<System.Drawing.RectangleF> rects);
member this.DrawRectangles : System.Drawing.Pen * ReadOnlySpan<System.Drawing.RectangleF> -> unit
Public Sub DrawRectangles (pen As Pen, rects As ReadOnlySpan(Of RectangleF))

Parametreler

pen
Pen

Şunlara uygulanır