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


C# Cairo.TextExtents方法代码示例

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


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

示例1: DrawContents

        protected override void DrawContents(Gdk.Drawable d, Cairo.Context g, int width, int height, bool screenChanged)
        {
            g.SelectFontFace(Text.MONOSPACE_FONT, FontSlant.Normal, FontWeight.Bold);
            g.SetFontSize(24);

            TextExtents te;

            Ability s = BattleState.Commanding.EnemySkillMenu.Selected;

            int row = 0;

            if (s != null)
            {
                string cost = s.MPCost.ToString();
                Text.ShadowedText(g, "MP Req", X + x1, Y + y0);

                row++;

                cost = cost + "/";
                te = g.TextExtents(cost);
                Text.ShadowedText(g, cost, X + x2 - te.Width, Y + y0 + (row * ys));

                string tot = BattleState.Commanding.MP.ToString();
                te = g.TextExtents(tot);
                Text.ShadowedText(g, tot, X + x3 - te.Width, Y + y0 + (row * ys));

                row++;
            }
        }
开发者ID:skinitimski,项目名称:Reverence,代码行数:29,代码来源:Info.cs

示例2: DrawContents

        protected override void DrawContents(Gdk.Drawable d, Cairo.Context g, int width, int height, bool screenChanged)
        {
            g.SelectFontFace(Text.MONOSPACE_FONT, FontSlant.Normal, FontWeight.Bold);
            g.SetFontSize(24);

            TextExtents te;

            Text.ShadowedText(g, "Time", X + x1, Y + y1);
            Text.ShadowedText(g, "Gil", X + x1, Y + y2);

            g.SelectFontFace("Courier New", FontSlant.Normal, FontWeight.Bold);

            long s, m, h;
            s = GameClock.Seconds;
            m = GameClock.Minutes;
            h = GameClock.Hours;

            string time = String.Format("{0:D2}:{1:D2}:{2:D2}", h, m, s);

            te = g.TextExtents(time);
            Text.ShadowedText(g, time, X + x2 - te.Width, Y + y1);

            te = g.TextExtents(Gil);
            Text.ShadowedText(g, Gil, X + x2 - te.Width, Y + y2);
        }
开发者ID:skinitimski,项目名称:Reverence,代码行数:25,代码来源:Time.cs

示例3: Draw

        public void Draw(Gdk.Drawable d, Cairo.Context g, int width, int height, bool screenChanged)
        {
            g.SelectFontFace(Text.MONOSPACE_FONT, FontSlant.Normal, FontWeight.Bold);
            g.SetFontSize(20);

            TextExtents te = g.TextExtents(Message);

            Text.ShadowedText(g, Color, Message, X - (te.Width / 2), Y - (te.Height / 2) + GetCurrentDisplacement());
        }
开发者ID:skinitimski,项目名称:Reverence,代码行数:9,代码来源:BattleIcon.cs

示例4: DrawVersionNumber

		void DrawVersionNumber (Cairo.Context c, ref Cairo.PointD bottomRight, string text)
		{
			c.SelectFontFace (SplashFontFamily, Cairo.FontSlant.Normal, Cairo.FontWeight.Normal);
			c.SetFontSize (SplashFontSize);
			
			var extents = c.TextExtents (text);
			c.MoveTo (bottomRight.X - extents.Width - 1, bottomRight.Y - extents.Height);
			
			c.Color = new Cairo.Color (1, 1, 1);
			c.ShowText (text);
		}
开发者ID:wickedshimmy,项目名称:monodevelop,代码行数:11,代码来源:SplashScreen.cs

示例5: DrawContents

        protected override void DrawContents(Gdk.Drawable d, Cairo.Context g, int width, int height, bool screenChanged)
        {
            g.SelectFontFace(Text.MONOSPACE_FONT, FontSlant.Normal, FontWeight.Bold);
            g.SetFontSize(24);

            TextExtents te;

            te = g.TextExtents(AP);
            Text.ShadowedText(g, "AP", X + x1, Y + ys);
            Text.ShadowedText(g, AP, X + x2 - te.Width, Y + ys);
        }
开发者ID:skinitimski,项目名称:Reverence,代码行数:11,代码来源:Ap.cs

示例6: DrawContents

        protected override void DrawContents(Gdk.Drawable d, Cairo.Context g, int width, int height, bool screenChanged)
        {
            g.SelectFontFace(Text.MONOSPACE_FONT, FontSlant.Normal, FontWeight.Bold);
            g.SetFontSize(24);

            TextExtents te;

            string gil = PostBattleState.Gil.ToString() + "g";
            te = g.TextExtents(gil);
            Text.ShadowedText(g, "Gained Gil", X + x1, Y + ys);
            Text.ShadowedText(g, gil, X + x2 - te.Width, Y + ys);
        }
开发者ID:skinitimski,项目名称:Reverence,代码行数:12,代码来源:GilLeft.cs

示例7: DrawContents

        protected override void DrawContents(Gdk.Drawable d, Cairo.Context g, int width, int height, bool screenChanged)
        {
            g.SelectFontFace(Text.MONOSPACE_FONT, FontSlant.Normal, FontWeight.Bold);
            g.SetFontSize(24);

            TextExtents te;

            Color textColor = Character.Death ? Colors.TEXT_RED : Colors.WHITE;

            if (Character != null)
            {
                Images.RenderProfile(d, X + xpic, Y + ypic, Character);

                Text.ShadowedText(g, textColor,Character.Name, X + x1, Y + y0);
                Text.ShadowedText(g, textColor, "Level:", X + x2, Y + y1);

                string lvl = Character.Level.ToString();
                te = g.TextExtents(lvl);
                Text.ShadowedText(g, textColor, lvl, X + x3 - te.Width, Y + y1);

                string temp = "Exp:";
                te = g.TextExtents(temp);
                Text.ShadowedText(g, textColor, temp, X + x4 - te.Width, Y + y0);

                temp = "For level up:";
                te = g.TextExtents(temp);
                Text.ShadowedText(g, textColor, temp, X + x4 - te.Width, Y + y1);

                string exp = Character.Exp.ToString() + "p";
                te = g.TextExtents(exp);
                Text.ShadowedText(g, textColor, exp, X + x5 - te.Width, Y + y0);

                string expNext = Character.ExpToNextLevel.ToString() + "p";
                te = g.TextExtents(expNext);
                Text.ShadowedText(g, textColor, expNext, X + x5 - te.Width, Y + y1);
            }
        }
开发者ID:skinitimski,项目名称:Reverence,代码行数:37,代码来源:Info.cs

示例8: DrawContents

        protected override void DrawContents(Gdk.Drawable d, Cairo.Context g, int width, int height, bool screenChanged)
        {
            BattleEvent e = BattleState.ActiveAbility;

            if (e != null)
            {
                g.SelectFontFace(Text.MONOSPACE_FONT, FontSlant.Normal, FontWeight.Bold);
                g.SetFontSize(24);

                string msg = e.GetStatus();

                TextExtents te = g.TextExtents(msg);

                Text.ShadowedText(g, msg, X + (W / 2) - (te.Width / 2), Y + 32);
            }
        }
开发者ID:skinitimski,项目名称:Reverence,代码行数:16,代码来源:EventBar.cs

示例9: DrawContents

        protected override void DrawContents(Gdk.Drawable d, Cairo.Context g, int width, int height, bool screenChanged)
        {
            g.SelectFontFace(Text.MONOSPACE_FONT, FontSlant.Normal, FontWeight.Bold);
            g.SetFontSize(24);

            TextExtents te;

            string msg = "";

            if (BattleState.Screen.Control != null)
            {
                msg = BattleState.Screen.Control.Info;
            }

            te = g.TextExtents(msg);

            Text.ShadowedText(g, msg, X + (W / 2) - (te.Width / 2), Y + 32);
        }
开发者ID:skinitimski,项目名称:Reverence,代码行数:18,代码来源:InfoBar.cs

示例10: DrawContents

        protected override void DrawContents(Gdk.Drawable d, Cairo.Context g, int width, int height, bool screenChanged)
        {
            g.SelectFontFace(Text.MONOSPACE_FONT, FontSlant.Normal, FontWeight.Bold);
            g.SetFontSize(24);

            TextExtents te;

            Text.ShadowedText(g, "Item", X + x1, Y + (ys * 1));

            List<Inventory.Record> taken = HoardItemLeft.Taken;

            for (int i = 0; i < taken.Count; i++)
            {
                if (taken[i].ID != "")
                {
                    string count = taken[i].Count.ToString();
                    te = g.TextExtents(count);
                    Text.ShadowedText(g, taken[i].Item.Name, X + x2, Y + (ys * (i + 2)));
                    Text.ShadowedText(g, count, X + x3 - te.Width, Y + (ys * (i + 2)));
                }
            }
        }
开发者ID:skinitimski,项目名称:Reverence,代码行数:22,代码来源:ItemRight.cs

示例11: DrawContents

        protected override void DrawContents(Gdk.Drawable d, Cairo.Context g, int width, int height, bool screenChanged)
        {
            string message = Message(Timer);

            TextExtents te = g.TextExtents(message);

            Move(100, 100);

            Width = (int)te.Width + w_padding * 2;
            Height = (int)te.Height + h_padding * 2;

            int x = ScreenState.Width / 2 - Width / 2;
            int y = ScreenState.Height / 2 - Height / 2;

            Move(x, y);

            g.SelectFontFace(Text.MONOSPACE_FONT, FontSlant.Normal, FontWeight.Bold);
            g.SetFontSize(24);

            double x_text = X + Width / 2 - te.Width / 2 - te.Width;
            double y_text = Y + Height / 2 - te.Height / 2;

            Text.ShadowedText(g, message, x_text, y_text);
        }
开发者ID:skinitimski,项目名称:Reverence,代码行数:24,代码来源:MessageBox.cs

示例12: DrawText

        private void DrawText(Cairo.Context cr, string text, double lineSpacing)
        {
            string [] lines = text.Split('\n');
            double [] cuml_heights = new double[lines.Length];
            double y_start = 0.0;

            for(int i = 0; i < lines.Length; i++) {
                TextExtents extents = cr.TextExtents(lines[i]);
                double height = extents.Height + (i > 0 ? lineSpacing : 0);
                cuml_heights[i] = i > 0 ? cuml_heights[i - 1] + height : height;
            }

            y_start = (Allocation.Height / 2) - (cuml_heights[cuml_heights.Length - 1] / 2);

            for(int i = 0; i < lines.Length; i++) {
                TextExtents extents = cr.TextExtents(lines[i]);

                double x = (Allocation.Width / 2) - (extents.Width / 2);
                double y = y_start + cuml_heights[i];

                cr.MoveTo(x, y);
                cr.ShowText(lines[i]);
            }
        }
开发者ID:haugjan,项目名称:banshee-hacks,代码行数:24,代码来源:DiscUsageDisplay.cs

示例13: TextExtents

        private Cairo.TextExtents TextExtents(Cairo.Context g, string str)
        {
            g.SelectFontFace (font_combo.ComboBox.ActiveText, FontSlant, FontWeight);
            g.SetFontSize (FontSize);

            return g.TextExtents (str);
        }
开发者ID:xxgreg,项目名称:Pinta,代码行数:7,代码来源:TextTool.cs

示例14: DrawCoords

            private void DrawCoords(Cairo.Context cairo)
            {
                cairo.Color = coordColor;
                // x-axis
                cairo.MoveTo (start_x, start_y);
                cairo.LineTo (start_x + graph_area_width,
                          start_y);
                cairo.Stroke ();

                // y-axis
                cairo.MoveTo (start_x, start_y);
                cairo.LineTo (start_x, offset_y);
                cairo.Stroke ();

                int max_height = 0;
                for (int i = 0; i < x_marks.Length; i++)
                  {
                      TextExtents extents =
                          cairo.
                          TextExtents (x_marks[i].
                                   name);
                      int height =
                          (int) Math.Round (extents.
                                    Height);
                      if (height > max_height)
                          max_height = height;
                  }

                for (int i = 0; i < x_marks.Length; i++)
                  {
                      if (i != 0)
                        {
                            cairo.MoveTo (start_x +
                                  x_marks[i].
                                  x, start_y);
                            cairo.LineTo (start_x +
                                  x_marks[i].
                                  x,
                                  offset_y);
                            cairo.Stroke ();
                        }

                      cairo.MoveTo (start_x +
                            x_marks[i].x,
                            start_y + offset +
                            max_height);
                      cairo.ShowText (x_marks[i].name);
                      cairo.Stroke ();
                  }

                for (int i = 0; i < y_marks.Length; i++)
                  {
                      TextExtents extents =
                          cairo.
                          TextExtents (y_marks[i].
                                   name);
                      int width =
                          (int) Math.Round (extents.
                                    Width);
                      int height =
                          (int) Math.Round (extents.
                                    Height);

                      cairo.MoveTo (start_x - offset / 2,
                            start_y -
                            y_marks[i].y);
                      cairo.LineTo (start_x + offset / 2,
                            start_y -
                            y_marks[i].y);
                      cairo.Stroke ();

                      cairo.MoveTo (start_x - offset -
                            width,
                            start_y -
                            y_marks[i].y +
                            height / 2);
                      cairo.ShowText (y_marks[i].name);
                      cairo.Stroke ();
                  }
            }
开发者ID:BackupTheBerlios,项目名称:csboard-svn,代码行数:80,代码来源:Graph.cs

示例15: DrawContents

        protected override void DrawContents(Gdk.Drawable d, Cairo.Context g, int width, int height, bool screenChanged)
        {
            g.SelectFontFace(Text.MONOSPACE_FONT, FontSlant.Normal, FontWeight.Bold);
            g.SetFontSize(24);

            TextExtents te;

            Text.ShadowedText(g, "Take everything", X + x1, Y + (ys * 1));

            for (int i = 0; i < _hoard.Count; i++)
            {
                if (_hoard[i].ID != "")
                {
                    string count = _hoard[i].Count.ToString();
                    te = g.TextExtents(count);
                    Text.ShadowedText(g, _hoard[i].Item.Name, X + x2, Y + (ys * (i + 2)));
                    Text.ShadowedText(g, count, X + x3 - te.Width, Y + (ys * (i + 2)));
                }
            }

            Text.ShadowedText(g, "Exit", X + x1, Y + (ys * 7));

            if (IsControl)
            {
                Shapes.RenderCursor(g, X + cx + x1, Y + cy + ys * (_option + 1));
            }
        }
开发者ID:skinitimski,项目名称:Reverence,代码行数:27,代码来源:ItemLeft.cs


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