当前位置: 首页>>代码示例>>C#>>正文


C# CairoContextEx.SetPangoNormalFontSize方法代码示例

本文整理汇总了C#中gbrainy.Core.Main.CairoContextEx.SetPangoNormalFontSize方法的典型用法代码示例。如果您正苦于以下问题:C# CairoContextEx.SetPangoNormalFontSize方法的具体用法?C# CairoContextEx.SetPangoNormalFontSize怎么用?C# CairoContextEx.SetPangoNormalFontSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gbrainy.Core.Main.CairoContextEx的用法示例。


在下文中一共展示了CairoContextEx.SetPangoNormalFontSize方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DrawPossibleAnswers

        public override void DrawPossibleAnswers(CairoContextEx gr, int area_width, int area_height, bool rtl)
        {
            double x= DrawAreaX, y = DrawAreaY + 0.1;
            int pos = 0;
            gr.Color = new Color (DefaultDrawingColor.R, DefaultDrawingColor.G, DefaultDrawingColor.B, 1);

            if (Answer.Draw ==  true) {
                DrawAllFigures (gr, start_x_ans, start_y, area_width, area_height);
                return;
            }

            gr.SetPangoNormalFontSize ();
            for (int i = 0; i < figures.Length; i++)
            {
                if (i == question_pos)
                    continue;

                gr.MoveTo (x, y);
                gr.ShowPangoText (FigureType.ToString (figures[i]));

                if ((pos + 1) % 3 == 0) {
                    y += 0.2;
                    x = DrawAreaX;
                } else {
                    x+= 0.30;
                }
                pos++;
            }
        }
开发者ID:syoubin,项目名称:gbrainy_android,代码行数:29,代码来源:MemoryFiguresAndText.cs

示例2: Draw

        public void Draw(CairoContextEx gr, int area_width, int area_height, bool rtl)
        {
            double y = 0.04, x = 0.05;
            const double space_small = 0.02;
            List <PlayerPersonalRecord> records;
            string s, tip, played;
            double width, height;

            gr.Scale (area_width, area_height);
            gr.Color = new Cairo.Color (0, 0, 0, 1);

            gr.MoveTo (x, y);
            gr.ShowPangoText (Translations.GetString ("Score"), false, -1, 0);
            DrawBand (gr, 0.03, y - 0.01);

            y += 0.08;
            gr.MoveTo (x, y);

            s = session.History.GetResult (Translations);

            // Translator: This will be part of the sentence "Games won: 10 (6 played)"
            played = String.Format (Translations.GetPluralString ("{0} played", "{0} played", session.History.GamesPlayed),
                session.History.GamesPlayed);

            if (s == string.Empty) {
                gr.ShowPangoText (String.Format (Translations.GetPluralString ("Games won: {0} ({1})",
                    "Games won: {0} ({1})", session.History.GamesWon), session.History.GamesWon, played));
            }
            else {
                gr.ShowPangoText (String.Format (Translations.GetPluralString ("{0}. Games won: {1} ({2})",
                    "{0}. Games won: {1} ({2})", session.History.GamesWon),	s, session.History.GamesWon, played));
            }

            y += 0.06;
            gr.MoveTo (x, y);
            gr.ShowPangoText (String.Format (Translations.GetString ("Time played {0} (average per game {1})"), session.GameTime, session.TimePerGame));

            y += 0.09;
            DrawColumnBarGraphic (gr, x, y);

            y += 0.36;
            gr.MoveTo (x, y);
            gr.SetPangoFontSize (smaller_font);
            // Translators: translated string should not be longer that the English original (space restriction on the UI)
            gr.ShowPangoText (Translations.GetString ("For details on how gbrainy's scoring works refer to the help."));

            y += 0.07;
            gr.SetPangoNormalFontSize ();
            records	= session.PlayerHistory.GetLastGameRecords ();
            gr.MoveTo (x, y);

            if (records.Count == 0) {
                bool caching = cached_sessionid != session.ID;

                gr.ShowPangoText (Translations.GetString ("Tips for your next games"), false, -1, 0);
                DrawBand (gr, 0.03, y - 0.01);

                y += 0.08;

                if (caching)
                    tips.Clear ();

                for (int i = 0; i < tips_shown; i++)
                {
                    if (caching)
                        tips.Add (game_tips.Tip);

                    tip = "- " + tips [i];

                    gr.MeasureString (tip, 1.0 - x, true, out width, out height);

                    if (y + height > 0.98)
                        break;

                    gr.DrawStringWithWrapping (x, y, tip , 1.0 - x);
                    y += height + space_small;
                }

                if (caching)
                    cached_sessionid = session.ID;
            }
            else  {
                gr.ShowPangoText (Translations.GetString ("Congratulations! New personal record"), false, -1, 0);
                DrawBand (gr, 0.03, y - 0.01);

                y += 0.08;

                for (int i = 0; i < records.Count; i++)
                {
                    switch (records[i].GameType) {
                    case GameTypes.LogicPuzzle:
                        s = String.Format (Translations.
                            GetString ("By scoring {0} in logic puzzle games you have established a new personal record. Your previous record was {1}."),
                            records[i].NewScore,
                            records[i].PreviousScore);
                        break;
                    case GameTypes.Calculation:
                        s = String.Format (Translations.
                            GetString ("By scoring {0} in calculation games you have established a new personal record. Your previous record was {1}."),
                            records[i].NewScore,
//.........这里部分代码省略.........
开发者ID:GNOME,项目名称:gbrainy,代码行数:101,代码来源:FinishView.cs

示例3: Draw

        public override void Draw(CairoContextEx gr, int area_width, int area_height, bool rtl)
        {
            int element;
            double x = DrawAreaX;
            double y = 0.05, pos_y;

            base.Draw (gr, area_width, area_height, rtl);

            for (int i = 0; i < (Answer.Draw ? question_columns : question_columns - 1); i++)
            {
                element = question_indices [i];
                pos_y = y;
                for (int n = 0; n < figures_column; n++)
                {
                    DrawFigure (gr, x, pos_y, figures [(n * question_columns) + element]);
                    pos_y+= figure_size + space_height;
                }
                x+= figure_size + space_width;
            }

            if (Answer.Draw == false) {
                gr.Save ();
                gr.SetPangoFontSize (figure_size);
                for (int n = 0; n < figures_column; n++) {
                    gr.MoveTo (x, y - 0.02);
                    gr.ShowPangoText ("?");
                    gr.Stroke ();
                    y+= figure_size + space_height;
                }
                gr.SetPangoNormalFontSize ();
                gr.Restore ();
            }

            gr.MoveTo (0.08, 0.45);
            gr.ShowPangoText (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Choose one of the following:"));
            gr.Stroke ();
        }
开发者ID:syoubin,项目名称:gbrainy_android,代码行数:37,代码来源:PuzzleFigures.cs

示例4: OnExposeEvent

        protected override bool OnExposeEvent(Gdk.EventExpose args)
        {
            if (!IsRealized)
                return false;

            int w, h, total_w, total_h;

            Cairo.Context cc = Gdk.CairoHelper.Create (args.Window);
            CairoContextEx cr = new CairoContextEx (cc.Handle, this);

            args.Window.GetSize (out total_w, out total_h);

            h = total_h - question_high;
            if (UseSolutionArea)
                h -= solution_high;

            w = total_w;

            // We want a square drawing area for the puzzles then the figures are shown as designed.
            // For example, squares are squares. This also makes sure that proportions are kept when resizing
            DrawingSquare = Math.Min (w, h);

            if (DrawingSquare < w)
                OffsetX = (w - DrawingSquare) / 2d;
            else
                OffsetX = 0;

            if (DrawingSquare < h)
                OffsetY = (h - DrawingSquare) / 2d;
            else
                OffsetY = 0;

            OffsetY += question_high;

            // Draw a background taking all the window area
            cr.Save ();
            cr.Scale (total_w, total_h);
            cr.DrawBackground ();

            if (Paused == false) {
                DrawQuestionAndAnswer (cr, total_h);
            } else {
                cr.SetPangoFontSize (0.08);
                cr.DrawTextCentered (0.5, 0.5, Catalog.GetString ("Paused"));
                cr.Stroke ();
            }
            cr.Restore ();

            if (Paused == false) {
                // Draw the game area
                cr.Translate (OffsetX, OffsetY);
                cr.SetPangoNormalFontSize ();
                cr.Color = new Color (1, 1, 1, 0.5);
                Drawable.Draw (cr, DrawingSquare, DrawingSquare, Direction == Gtk.TextDirection.Rtl);
                cr.Stroke ();
            }

            ((IDisposable)cc).Dispose();
            ((IDisposable)cr).Dispose();
            return true;
        }
开发者ID:syoubin,项目名称:gbrainy_android,代码行数:61,代码来源:GameDrawingArea.cs

示例5: Draw

        public override void Draw(CairoContextEx gr, int area_width, int area_height, bool rtl)
        {
            double org_x = DrawAreaX + 0.1;
            double x = org_x, y = 0.08;
            double x45, y45, x135, y135, offset;

            base.Draw (gr, area_width, area_height, rtl);

            // First pattern
            gr.Rectangle (x, y, figure_size, figure_size);
            gr.MoveTo (x, y);
            gr.LineTo (x + figure_size, y + figure_size);
            gr.MoveTo (x + figure_size, y);
            gr.LineTo (x, y + figure_size);
            gr.MoveTo (x + figure_size / 2, y);
            gr.LineTo (x + figure_size / 2, y + figure_size);
            gr.MoveTo (x, y + figure_size / 2);
            gr.LineTo (x + figure_size, y + figure_size / 2);
            gr.Stroke ();

            x += figure_size + space_x;
            gr.Rectangle (x, y, figure_size, figure_size);
            gr.MoveTo (x + figure_size / 2, y);
            gr.LineTo (x + figure_size / 2, y + figure_size);
            gr.MoveTo (x, y + figure_size / 2);
            gr.LineTo (x + figure_size, y + figure_size / 2);
            gr.Stroke ();

            x += figure_size + space_x;
            DrawCross (gr, x, y, figure_size);

            y += space_y;
            x = org_x;
            // Second pattern
            gr.Rectangle (x, y, figure_size, figure_size);
            gr.MoveTo (x, y);
            gr.LineTo (x + figure_size, y + figure_size);
            gr.MoveTo (x + figure_size, y);
            gr.LineTo (x, y + figure_size);
            gr.Stroke ();

            x += figure_size + space_x;
            DrawRotatedCross (gr, x, y, figure_size);

            // Rotated rectangle
            x += figure_size + space_x;
            x45 = figure_size * Math.Cos (45 * Math.PI / 180);
            y45 = figure_size * Math.Sin (45 * Math.PI / 180);
            x135 = figure_size * Math.Cos (135 * Math.PI / 180);
            y135 = figure_size * Math.Sin (135 * Math.PI / 180);
            offset = - 0.03;
            // Down-right
            gr.MoveTo (x + figure_size / 2, y + offset);
            gr.LineTo (x + figure_size / 2 + x45, y + offset + y45);
            // Up right
            gr.LineTo ((x + figure_size / 2 + x45) + x135, (y + offset +  y45) + y135);
            gr.Stroke ();
            // Down left
            gr.MoveTo (x + figure_size / 2, y + offset);
            gr.LineTo (x + figure_size / 2 + x135, y + offset + y135);
            // Up left
            gr.LineTo (x + figure_size / 2 + x135 + x45, y + offset + y135 + y45);
            gr.Stroke ();

            y += space_y;
            x = org_x;

            // Third pattern
            gr.MoveTo (x, y);
            gr.LineTo (x + figure_size, y);
            gr.LineTo (x, y + figure_size);
            gr.LineTo (x + figure_size, y  + figure_size);
            gr.Stroke ();

            x += figure_size + space_x;
            gr.MoveTo (x + figure_size, y);
            gr.LineTo (x, y);
            gr.LineTo (x + figure_size, y + figure_size);
            gr.LineTo (x, y  + figure_size);
            gr.Stroke ();

            x += figure_size + space_x;
            gr.MoveTo (x + 0.03, y - 0.02);
            gr.SetPangoFontSize (figure_size);
            gr.ShowPangoText ("?");
            gr.SetPangoNormalFontSize ();
            gr.Stroke ();

            gr.MoveTo (0.05, y - 0.01 + space_y);
            gr.ShowPangoText (Translations.GetString ("Choose one of the following:"));
            gr.Stroke ();
        }
开发者ID:GNOME,项目名称:gbrainy,代码行数:92,代码来源:PuzzleFigurePattern.cs

示例6: Draw

        public override void Draw(CairoContextEx gr, int area_width, int area_height, bool rtl)
        {
            double org_x = DrawAreaX + 0.1;
            double x = org_x, y = 0.08;
            const double figure_size = 0.13, space_x = 0.1, space_y = 0.18;
            double x45, y45, x135, y135, offset;

            base.Draw (gr, area_width, area_height, rtl);

            // First pattern
            gr.Rectangle (x, y, figure_size, figure_size);
            gr.MoveTo (x, y);
            gr.LineTo (x + figure_size, y + figure_size);
            gr.MoveTo (x + figure_size, y);
            gr.LineTo (x, y + figure_size);
            gr.MoveTo (x + figure_size / 2, y);
            gr.LineTo (x + figure_size / 2, y + figure_size);
            gr.MoveTo (x, y + figure_size / 2);
            gr.LineTo (x + figure_size, y + figure_size / 2);
            gr.Stroke ();

            x += figure_size + space_x;
            gr.Rectangle (x, y, figure_size, figure_size);
            gr.MoveTo (x + figure_size / 2, y);
            gr.LineTo (x + figure_size / 2, y + figure_size);
            gr.MoveTo (x, y + figure_size / 2);
            gr.LineTo (x + figure_size, y + figure_size / 2);
            gr.Stroke ();

            x += figure_size + space_x;
            DrawCross (gr, x, y, figure_size);

            y += space_y;
            x = org_x;
            // Second pattern
            gr.Rectangle (x, y, figure_size, figure_size);
            gr.MoveTo (x, y);
            gr.LineTo (x + figure_size, y + figure_size);
            gr.MoveTo (x + figure_size, y);
            gr.LineTo (x, y + figure_size);
            gr.Stroke ();

            x += figure_size + space_x;
            DrawRotatedCross (gr, x, y, figure_size);

            // Rotated rectangle
            x += figure_size + space_x;
            x45 = figure_size * Math.Cos (45 * Math.PI / 180);
            y45 = figure_size * Math.Sin (45 * Math.PI / 180);
            x135 = figure_size * Math.Cos (135 * Math.PI / 180);
            y135 = figure_size * Math.Sin (135 * Math.PI / 180);
            offset = - 0.03;
            // Down-right
            gr.MoveTo (x + figure_size / 2, y + offset);
            gr.LineTo (x + figure_size / 2 + x45, y + offset + y45);
            // Up right
            gr.LineTo ((x + figure_size / 2 + x45) + x135, (y + offset +  y45) + y135);
            gr.Stroke ();
            // Down left
            gr.MoveTo (x + figure_size / 2, y + offset);
            gr.LineTo (x + figure_size / 2 + x135, y + offset + y135);
            // Up left
            gr.LineTo (x + figure_size / 2 + x135 + x45, y + offset + y135 + y45);
            gr.Stroke ();

            y += space_y;
            x = org_x;

            // Third pattern
            gr.MoveTo (x, y);
            gr.LineTo (x + figure_size, y);
            gr.LineTo (x, y + figure_size);
            gr.LineTo (x + figure_size, y  + figure_size);
            gr.Stroke ();

            x += figure_size + space_x;
            gr.MoveTo (x + figure_size, y);
            gr.LineTo (x, y);
            gr.LineTo (x + figure_size, y + figure_size);
            gr.LineTo (x, y  + figure_size);
            gr.Stroke ();

            x += figure_size + space_x;
            gr.MoveTo (x + 0.03, y - 0.02);
            gr.SetPangoFontSize (figure_size);
            gr.ShowPangoText ("?");
            gr.SetPangoNormalFontSize ();
            gr.Stroke ();

            gr.MoveTo (0.05, y - 0.01 + space_y);
            gr.ShowPangoText (Translations.GetString ("Choose one of the following:"));

            // Answers
            x = org_x;
            y += space_y + 0.07;

            for (int i = 0; i < (int) Figures.Last; i++)
            {
             	switch ((Figures) random_indices[i]) {
                case Figures.TwoLines:
//.........这里部分代码省略.........
开发者ID:dineshkummarc,项目名称:gbrainy,代码行数:101,代码来源:PuzzleFigurePattern.cs

示例7: DrawPossibleAnswers

        public override void DrawPossibleAnswers(CairoContextEx gr, int area_width, int area_height, bool rtl)
        {
            double x= DrawAreaX, y = DrawAreaY + 0.085;
            int pos = 0;
            gr.Color = new Color (DefaultDrawingColor.R, DefaultDrawingColor.G, DefaultDrawingColor.B, 1);

            if (Answer.Draw ==  true) {
                DrawAllFigures (gr, start_x_ans, start_y);
                return;
            }

            gr.SetPangoNormalFontSize ();
            for (int i = 0; i < figures.Length; i++)
            {
                if (i == question_pos)
                    continue;

                gr.MoveTo (x, y);
                gr.ShowPangoText (converter.ToString (figures[i]));

                if ((pos + 1) % 4 == 0) {
                    y += 0.1;
                    x = DrawAreaX;
                } else {
                    x+= 0.25;
                }
                pos++;
            }

            base.DrawPossibleAnswers (gr,  area_width, area_height, rtl);

            gr.SetPangoLargeFontSize ();
            gr.MoveTo (0, 0.4);
            gr.ShowPangoText (Translations.GetString ("Choose one of the following:"));

            gr.MoveTo (0, 0.08);
            gr.ShowPangoText (Translations.GetString ("List of images shown before"));
        }
开发者ID:GNOME,项目名称:gbrainy,代码行数:38,代码来源:MemoryFiguresAndText.cs


注:本文中的gbrainy.Core.Main.CairoContextEx.SetPangoNormalFontSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。