dd

Silverlight 引路蜂二维图形库示例:椭圆

jerry Silverligth 2015年11月26日 收藏

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);
}

dd