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

jerry Silverligth 2015年11月26日 收藏

FillOval 和DrawOval 用来填充和绘制椭圆。下面例子显示椭圆的用法。

  1. private void Ovals()
  2. {
  3.  Color redColor = new Color(0x96ff0000, true);
  4.  Color greenColor = new Color(0x00ff00);
  5.  AffineTransform mat1;
  6.  mat1 = new AffineTransform();
  7.  mat1.Translate(30, 40);
  8.  mat1.Rotate(-30 * Math.PI / 180.0);
  9.  graphics2D.Reset();
  10.  graphics2D.Clear(Color.White);
  11.  
  12.  graphics2D.AffineTransform = new AffineTransform();
  13.  SolidBrush brush = new SolidBrush(greenColor);
  14.  graphics2D.FillOval(brush, 20, 60, 100, 50);
  15.  
  16.  Pen pen = new Pen(redColor, 5);
  17.  graphics2D.AffineTransform = mat1;
  18.  graphics2D.DrawOval(pen, 20, 60, 100, 50);
  19. }