本文整理匯總了C#中System.Drawing.Graphics.FillRectangles方法的典型用法代碼示例。如果您正苦於以下問題:C# Graphics.FillRectangles方法的具體用法?C# Graphics.FillRectangles怎麽用?C# Graphics.FillRectangles使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Drawing.Graphics
的用法示例。
在下文中一共展示了Graphics.FillRectangles方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: FillRectanglesRectangleF
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);
}
示例2: FillRectanglesRectangle
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);
}
示例3: Main
//引入命名空間
using System;
using System.Drawing;
using System.Windows.Forms;
class FourByFours: Form
{
public static void Main()
{
Application.Run(new FourByFours());
}
public FourByFours()
{
Text = "Four by Fours";
ResizeRedraw = true;
}
protected override void OnPaint(PaintEventArgs pea)
{
DoPage(pea.Graphics, ForeColor,ClientSize.Width, ClientSize.Height);
}
protected void DoPage(Graphics grfx, Color clr, int cx, int cy)
{
Pen pen = new Pen(clr);
Brush brush = new SolidBrush(clr);
grfx.FillRectangles(brush, new Rectangle[]
{new Rectangle(8, 8, 4, 4)});
}
}