Graphics.FillEllipse 方法 (Brush, Int32, Int32, Int32, Int32)
.NET Framework (current version)
填充边框所定义的椭圆的内部,该边框由一对坐标、一个宽度和一个高度指定。
程序集: System.Drawing(位于 System.Drawing.dll)
参数
-
brush
-
Type:
System.Drawing.Brush
确定填充特性的 Brush。
-
x
-
Type:
System.Int32
定义椭圆的边框的左上角的 X 坐标。
-
y
-
Type:
System.Int32
定义椭圆的边框的左上角的 Y 坐标。
-
width
-
Type:
System.Int32
定义椭圆的边框的宽度。
-
height
-
Type:
System.Int32
定义椭圆的边框的高度。
Exception | Condition |
---|---|
ArgumentNullException |
brush 为 null。 |
下面的代码示例仅用于 Windows 窗体,并且它要求在 PaintEventArgse, ,这是一个参数的 Paint 事件处理程序。 该代码执行下列操作:
-
创建实心的红色画笔。
-
创建的位置和大小来限定椭圆的矩形。
-
填充椭圆在屏幕上。
public void FillEllipseInt(PaintEventArgs e) { // Create solid brush. SolidBrush redBrush = new SolidBrush(Color.Red); // Create location and size of ellipse. int x = 0; int y = 0; int width = 200; int height = 100; // Fill ellipse on screen. e.Graphics.FillEllipse(redBrush, x, y, width, height); }
.NET Framework
自 1.1 起可用