當前位置: 首頁>>代碼示例>>C#>>正文


C# CairoContextEx.DrawDiamond方法代碼示例

本文整理匯總了C#中gbrainy.Core.Main.CairoContextEx.DrawDiamond方法的典型用法代碼示例。如果您正苦於以下問題:C# CairoContextEx.DrawDiamond方法的具體用法?C# CairoContextEx.DrawDiamond怎麽用?C# CairoContextEx.DrawDiamond使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在gbrainy.Core.Main.CairoContextEx的用法示例。


在下文中一共展示了CairoContextEx.DrawDiamond方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: DrawFigure

 private static void DrawFigure(CairoContextEx gr, double x, double y, Figures figure)
 {
     switch (figure) {
     case Figures.TriangleA:
         gr.DrawEquilateralTriangle (x, y, figure_size);
         break;
     case Figures.TriangleB:
         gr.MoveTo (x, y);
         gr.LineTo (x, y + figure_size);
         gr.LineTo (x + figure_size, y);
         gr.LineTo (x, y);
         gr.Stroke ();
         break;
     case Figures.TriangleC:
         gr.MoveTo (x, y);
         gr.LineTo (x, y + figure_size);
         gr.LineTo (x + figure_size, y + figure_size);
         gr.LineTo (x, y);
         gr.Stroke ();
         break;
     case Figures.Square:
         gr.Rectangle (x, y, figure_size, figure_size);
         gr.Stroke ();
         break;
     case Figures.LongRectangle:
         gr.Rectangle (x, y + figure_size / 2, figure_size, figure_size / 2);
         gr.Stroke ();
         break;
     case Figures.LongRectangleUp:
         gr.Rectangle (x, y, figure_size, figure_size / 2);
         gr.Stroke ();
         break;
     case Figures.Diamon:
         gr.DrawDiamond (x, y, figure_size);
         break;
     case Figures.TriangleD:
         gr.MoveTo (x, y);
         gr.LineTo (x, y + figure_size * 0.7);
         gr.LineTo (x + figure_size * 0.7, y + figure_size * 0.7);
         gr.LineTo (x, y);
         gr.Stroke ();
         break;
     }
 }
開發者ID:syoubin,項目名稱:gbrainy_android,代碼行數:44,代碼來源:PuzzleBuildTriangle.cs

示例2: DrawFigure

        private void DrawFigure(CairoContextEx gr, double x, double y, FigureType fig)
        {
            double space_x, space_y;

            space_x = (rect_w - figure_size) / 2;
            space_y = (rect_h - figure_size) / 2;

            switch (fig) {
            case FigureType.Triangle:
                gr.DrawEquilateralTriangle (x + space_x, y + space_y, figure_size);
                break;
            case FigureType.Rectangle:
                gr.Rectangle (x + space_x, y + space_y, figure_size, figure_size);
                gr.Stroke ();
                break;
            case FigureType.Diamond:
                gr.DrawDiamond (x + space_x, y + space_y, figure_size);
                break;
            case FigureType.Cercle:
                gr.Arc (x + space_x + figure_size / 2, y + space_y + figure_size / 2, figure_size / 2, 0, 2 * Math.PI);
                gr.Stroke ();
                break;
            case FigureType.TriangleWithLine:
                gr.DrawEquilateralTriangle (x + space_x, y + space_y, figure_size);
                gr.MoveTo (x + space_x + figure_size / 2, y + space_y);
                gr.LineTo (x + space_x + figure_size / 2, y + space_y + figure_size);
                gr.Stroke ();
                break;
            case FigureType.RectangleWithLine:
                gr.Rectangle (x + space_x, y + space_y, figure_size, figure_size);
                gr.MoveTo (x + space_x, y + space_y);
                gr.LineTo (x + space_x + figure_size, y + space_y + figure_size);
                gr.MoveTo (x + space_x + figure_size, y + space_y);
                gr.LineTo (x + space_x, y + space_y + figure_size);
                gr.Stroke ();
                break;
            case FigureType.DiamondWithLine:
                gr.DrawDiamond (x + space_x, y + space_y, figure_size);
                gr.MoveTo (x + space_x + figure_size / 2, y + space_y);
                gr.LineTo (x + space_x + figure_size / 2, y + space_y + figure_size);
                gr.Stroke ();
                break;
            case FigureType.CercleWithLine:
                gr.Arc (x + space_x + figure_size / 2, y + space_y + figure_size / 2, figure_size / 2, 0, 2 * Math.PI);
                gr.Stroke ();
                gr.MoveTo (x + space_x + figure_size / 2, y + space_y);
                gr.LineTo (x + space_x + figure_size / 2, y + space_y + figure_size);
                gr.Stroke ();
                break;
            }
        }
開發者ID:syoubin,項目名稱:gbrainy_android,代碼行數:51,代碼來源:MemoryFigures.cs


注:本文中的gbrainy.Core.Main.CairoContextEx.DrawDiamond方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。