本文整理匯總了C#中gbrainy.Core.Main.CairoContextEx.DrawPentagon方法的典型用法代碼示例。如果您正苦於以下問題:C# CairoContextEx.DrawPentagon方法的具體用法?C# CairoContextEx.DrawPentagon怎麽用?C# CairoContextEx.DrawPentagon使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類gbrainy.Core.Main.CairoContextEx
的用法示例。
在下文中一共展示了CairoContextEx.DrawPentagon方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: DrawFigure
static void DrawFigure(CairoContextEx gr, double x, double y, Figure figure)
{
switch (figure)
{
case Figure.Pentagon:
gr.DrawPentagon (x, y, figure_size);
break;
case Figure.Circle:
gr.Arc (x + figure_size / 2, y + (figure_size / 2), figure_size / 2, 0, 2 * Math.PI);
break;
case Figure.Triangle:
gr.DrawEquilateralTriangle (x, y, figure_size);
break;
default:
throw new InvalidOperationException ("Invalid figure type");
}
gr.Stroke ();
}
示例2: DrawFigure
void DrawFigure(CairoContextEx gr, double x, double y, FigureType type)
{
double space_x, space_y;
space_x = (rect_w - figure_size) / 2;
space_y = (rect_h - figure_size) / 2;
switch (type) {
case FigureType.Triangle:
gr.DrawEquilateralTriangle (x + space_x, y + space_y, figure_size);
break;
case FigureType.Square:
gr.Rectangle (x + space_x, y + space_y, figure_size, figure_size);
gr.Stroke ();
break;
case FigureType.Pentagon:
gr.DrawPentagon (x + space_x, y + space_y, figure_size);
break;
case FigureType.Circle:
gr.Arc (x + space_x + figure_size / 2, y + space_y + figure_size / 2, figure_size / 2, 0, 2 * Math.PI);
gr.Stroke ();
break;
default:
throw new InvalidOperationException ();
}
}