本文整理汇总了C#中Drawable.DrawPolygon方法的典型用法代码示例。如果您正苦于以下问题:C# Drawable.DrawPolygon方法的具体用法?C# Drawable.DrawPolygon怎么用?C# Drawable.DrawPolygon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drawable
的用法示例。
在下文中一共展示了Drawable.DrawPolygon方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Draw
public void Draw(Drawable draw, Gdk.Color back)
{
Gdk.GC gc = new Gdk.GC(draw);
try {
int width;
int height;
draw.GetSize(out width, out height);
int xPoint = (width * Volume) / 100;
int yTop = height * Volume / 100;
List<Point> points = new List<Point>();
points.Add(new Point(0,0));
points.Add(new Point(xPoint, yTop));
points.Add(new Point(xPoint, height));
points.Add(new Point(0,height));
points.Add(new Point(0,0));
gc.Foreground = back;
gc.Background = back;
draw.DrawPolygon(gc, true, points.ToArray());
draw.DrawRectangle(gc, true, xPoint, 0, width, height);
points.Clear();
points.Add(new Point(0,0));
points.Add(new Point(xPoint, yTop));
points.Add(new Point(xPoint, 0));
points.Add(new Point(0,0));
gc.Foreground = new Gdk.Color(0,128,0);
gc.Background = new Gdk.Color(0,128,0);
draw.DrawPolygon(gc, true, points.ToArray());
} catch (Exception ex) {
Console.WriteLine(ex.Source);
Console.WriteLine(ex.StackTrace);
}
gc.Dispose();
}