Graphics.FillRectangles 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
填滿 Rectangle 結構所指定之一系列矩形的內部。
多載
FillRectangles(Brush, ReadOnlySpan<RectangleF>)
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
public:
void FillRectangles(System::Drawing::Brush ^ brush, ReadOnlySpan<System::Drawing::RectangleF> rects);
public void FillRectangles (System.Drawing.Brush brush, scoped ReadOnlySpan<System.Drawing.RectangleF> rects);
member this.FillRectangles : System.Drawing.Brush * ReadOnlySpan<System.Drawing.RectangleF> -> unit
Public Sub FillRectangles (brush As Brush, rects As ReadOnlySpan(Of RectangleF))
參數
- brush
- Brush
- rects
- ReadOnlySpan<RectangleF>
適用於
FillRectangles(Brush, ReadOnlySpan<Rectangle>)
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
public:
void FillRectangles(System::Drawing::Brush ^ brush, ReadOnlySpan<System::Drawing::Rectangle> rects);
public void FillRectangles (System.Drawing.Brush brush, scoped ReadOnlySpan<System.Drawing.Rectangle> rects);
member this.FillRectangles : System.Drawing.Brush * ReadOnlySpan<System.Drawing.Rectangle> -> unit
Public Sub FillRectangles (brush As Brush, rects As ReadOnlySpan(Of Rectangle))
參數
- brush
- Brush
- rects
- ReadOnlySpan<Rectangle>
適用於
FillRectangles(Brush, RectangleF[])
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
填滿 RectangleF 結構所指定之一系列矩形的內部。
public:
void FillRectangles(System::Drawing::Brush ^ brush, cli::array <System::Drawing::RectangleF> ^ rects);
public:
void FillRectangles(System::Drawing::Brush ^ brush, ... cli::array <System::Drawing::RectangleF> ^ rects);
public void FillRectangles (System.Drawing.Brush brush, System.Drawing.RectangleF[] rects);
public void FillRectangles (System.Drawing.Brush brush, params System.Drawing.RectangleF[] rects);
member this.FillRectangles : System.Drawing.Brush * System.Drawing.RectangleF[] -> unit
Public Sub FillRectangles (brush As Brush, rects As RectangleF())
Public Sub FillRectangles (brush As Brush, ParamArray rects As RectangleF())
參數
- rects
- RectangleF[]
RectangleF 結構的陣列,代表要填滿的矩形。
例外狀況
Rects
是長度為零的陣列。
範例
下列程式代碼範例是專為搭配 Windows Forms 使用而設計,而且需要 PaintEventArgse
,這是 Paint 事件處理程式的參數。 程式代碼會執行下列動作:
建立純藍色筆刷。
建立三個矩形的陣列。
填滿螢幕上的三個矩形區域。
public:
void FillRectanglesRectangleF( PaintEventArgs^ e )
{
// Create solid brush.
SolidBrush^ blueBrush = gcnew SolidBrush( Color::Blue );
// 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)};
// Fill rectangles to screen.
e->Graphics->FillRectangles( blueBrush, rects );
}
private 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);
}
Private Sub FillRectanglesRectangleF(ByVal e As PaintEventArgs)
' Create solid brush.
Dim blueBrush As New SolidBrush(Color.Blue)
' 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)}
' Fill rectangles to screen.
e.Graphics.FillRectangles(blueBrush, rects)
End Sub
適用於
FillRectangles(Brush, Rectangle[])
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
填滿 Rectangle 結構所指定之一系列矩形的內部。
public:
void FillRectangles(System::Drawing::Brush ^ brush, cli::array <System::Drawing::Rectangle> ^ rects);
public:
void FillRectangles(System::Drawing::Brush ^ brush, ... cli::array <System::Drawing::Rectangle> ^ rects);
public void FillRectangles (System.Drawing.Brush brush, System.Drawing.Rectangle[] rects);
public void FillRectangles (System.Drawing.Brush brush, params System.Drawing.Rectangle[] rects);
member this.FillRectangles : System.Drawing.Brush * System.Drawing.Rectangle[] -> unit
Public Sub FillRectangles (brush As Brush, rects As Rectangle())
Public Sub FillRectangles (brush As Brush, ParamArray rects As Rectangle())
參數
例外狀況
rects
是長度為零的陣列。
範例
下列程式代碼範例是專為搭配 Windows Forms 使用而設計,而且需要 PaintEventArgse
,這是 Paint 事件處理程式的參數。 程式代碼會執行下列動作:
建立純藍色筆刷。
建立三個矩形的陣列。
填滿螢幕上的三個矩形區域。
public:
void FillRectanglesRectangle( PaintEventArgs^ e )
{
// Create solid brush.
SolidBrush^ blueBrush = gcnew SolidBrush( Color::Blue );
// Create array of rectangles.
array<Rectangle>^ rects = {Rectangle(0,0,100,200),Rectangle(100,200,250,50),Rectangle(300,0,50,100)};
// Fill rectangles to screen.
e->Graphics->FillRectangles( blueBrush, rects );
}
private 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);
}
Private Sub FillRectanglesRectangle(ByVal 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