本文整理汇总了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++;
}
}
示例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);
}
示例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());
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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)));
}
}
}
示例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);
}
示例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]);
}
}
示例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);
}
示例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 ();
}
}
示例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));
}
}