本文整理汇总了C#中Android.DrawOval方法的典型用法代码示例。如果您正苦于以下问题:C# Android.DrawOval方法的具体用法?C# Android.DrawOval怎么用?C# Android.DrawOval使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android
的用法示例。
在下文中一共展示了Android.DrawOval方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Draw
public override void Draw(Android.Graphics.Canvas canvas)
{
base.Draw(canvas);
var rect = new RectF(0,0,300,300);
switch (TheShape)
{
case Shape.Circle:
canvas.DrawOval(rect, new Paint() { Color = Color.Aqua });
break;
case Shape.Square:
canvas.DrawRect(rect, new Paint() { Color = Color.Red });
break;
case Shape.Triangle:
var path = new Path();
path.MoveTo(rect.CenterX(), 0);
path.LineTo(0, rect.Height());
path.LineTo(rect.Width(), rect.Height());
path.Close();
var paint = new Paint() {Color = Color.Magenta};
paint.SetStyle(Paint.Style.Fill);
canvas.DrawPath(path, paint);
break;
default:
throw new ArgumentOutOfRangeException();
}
}
示例2: OnDraw
protected override void OnDraw(Android.Graphics.Canvas canvas)
{
var rect = new RectF(0, 0, 300, 300);
switch (Shape)
{
case Shape.Circle:
canvas.DrawOval(rect, new Paint() { Color = Color.CornflowerBlue });
break;
case Shape.Square:
canvas.DrawRect(rect, new Paint() { Color = Color.Crimson });
break;
case Shape.Triangle:
var path = new Path();
path.MoveTo(rect.CenterX(), rect.Top);
path.LineTo(rect.Left, rect.Bottom);
path.LineTo(rect.Right, rect.Bottom);
path.Close();
var paint = new Paint() {Color = Color.Crimson};
paint.Color = Color.Gold;
paint.SetStyle(Paint.Style.Fill);
canvas.DrawPath(path, paint);
break;
default:
throw new ArgumentOutOfRangeException();
}
}
示例3: Draw
public override void Draw(Android.Graphics.Canvas canvas)
{
canvas.DrawOval(mRectF, mPaint);
}