FillOval 和DrawOval 用来填充和绘制椭圆。下面例子显示椭圆的用法。
private void Ovals() { Color redColor = new Color(0x96ff0000, true); Color greenColor = new Color(0x00ff00); AffineTransform mat1; mat1 = new AffineTransform(); mat1.Translate(30, 40); mat1.Rotate(-30 * Math.PI / 180.0); graphics2D.Reset(); graphics2D.Clear(Color.White); graphics2D.AffineTransform = new AffineTransform(); SolidBrush brush = new SolidBrush(greenColor); graphics2D.FillOval(brush, 20, 60, 100, 50); Pen pen = new Pen(redColor, 5); graphics2D.AffineTransform = mat1; graphics2D.DrawOval(pen, 20, 60, 100, 50); }