本文整理汇总了C#中gbrainy.Core.Main.CairoContextEx.DrawTextCentered方法的典型用法代码示例。如果您正苦于以下问题:C# CairoContextEx.DrawTextCentered方法的具体用法?C# CairoContextEx.DrawTextCentered怎么用?C# CairoContextEx.DrawTextCentered使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gbrainy.Core.Main.CairoContextEx
的用法示例。
在下文中一共展示了CairoContextEx.DrawTextCentered方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Draw
public override void Draw(CairoContextEx gr, int area_width, int area_height, bool rtl)
{
double rect_w = DrawAreaWidth / rows;
double rect_h = DrawAreaHeight / columns;
base.Draw (gr, area_width, area_height, rtl);
for (int column = 0; column < columns; column++) {
for (int row = 0; row < rows; row++) {
gr.Color = DefaultDrawingColor;
gr.Rectangle (DrawAreaX + row * rect_w, DrawAreaY + column * rect_h, rect_w, rect_h);
gr.Stroke ();
gr.DrawTextCentered (DrawAreaX + (rect_w / 2) + column * rect_w, (rect_h / 2) + DrawAreaY + row * rect_h,
(numbers[column + (row * 4)]).ToString() );
if (numbers[column + (row * 4)] % divisor == 0 && good_pos != column + (row * 4)) {
gr.Arc (DrawAreaX + (rect_w / 2) + column * rect_w, (rect_h / 2) + DrawAreaY + row * rect_h,
0.05, 0, 2 * Math.PI);
gr.FillGradient (DrawAreaX + (rect_w / 2) + column * rect_w, (rect_h / 2) + DrawAreaY + row * rect_h,
0.05, 0.05);
}
gr.Stroke ();
}
}
}
示例2: Draw
public override void Draw(CairoContextEx gr, int area_width, int area_height, bool rtl)
{
base.Draw (gr, area_width, area_height, rtl);
gr.SetPangoLargeFontSize ();
gr.DrawTextCentered (0.5, DrawAreaY + 0.3, formula);
}
示例3: Draw
public override void Draw(CairoContextEx gr, int area_width, int area_height, bool rtl)
{
base.Draw (gr, area_width, area_height, rtl);
gr.Color = new Color (0.4, 0.4, 0.4);
gr.DrawTextCentered (0.5, DrawAreaY, "This is an extension sample");
}
示例4: Draw
public override void Draw(CairoContextEx gr, int area_width, int area_height, bool rtl)
{
base.Draw (gr, area_width, area_height, rtl);
gr.DrawImageFromAssembly ("people_table.svg", 0.2, 0.2, 0.6, 0.6);
gr.DrawTextCentered (0.5, 0.85,
Translations.GetString ("Two people in the table sitting across each other"));
}
示例5: Draw
public override void Draw(CairoContextEx gr, int area_width, int area_height, bool rtl)
{
base.Draw (gr, area_width, area_height, rtl);
gr.DrawClock (DrawAreaX + 0.4, DrawAreaY + 0.4, figure_size,
0, 0 /* No hands */);
gr.DrawTextCentered (0.5, DrawAreaY + 0.3 + figure_size, Translations.GetString ("Sample clock"));
}
示例6: Draw
public void Draw(CairoContextEx gr, int area_width, int area_height, bool rtl)
{
gr.Scale (area_width, area_height);
gr.LineWidth = 0.01;
gr.Color = new Cairo.Color (0, 0, 0, 1);
gr.SetPangoLargeFontSize ();
gr.DrawTextCentered (0.5, 0.1, ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Get ready to memorize the next objects..."));
gr.Stroke ();
gr.SetPangoFontSize (0.35);
gr.DrawTextCentered (0.5, 0.5, countdown_time.ToString ());
gr.Stroke ();
gr.Arc (0.5, 0.5, 0.25, 0, 2 * Math.PI);
gr.Stroke ();
gr.Arc (0.5, 0.5, 0.28, 0, 2 * Math.PI);
gr.Stroke ();
}
示例7: DrawObjectToMemorize
public override void DrawObjectToMemorize(CairoContextEx gr, int area_width, int area_height, bool rtl)
{
StringBuilder sequence = new StringBuilder (64);
base.DrawObjectToMemorize (gr, area_width, area_height, rtl);
gr.SetPangoLargeFontSize ();
for (int num = 0; num < Challenge.Numbers.Length - 1; num++)
{
sequence.Append (Challenge.Numbers [num]);
sequence.Append (", ");
}
sequence.Append (Challenge.Numbers [Challenge.Numbers.Length - 1]);
gr.DrawTextCentered (0.5, DrawAreaY + 0.3, sequence.ToString ());
}
示例8: Draw
public override void Draw(CairoContextEx gr, int area_width, int area_height, bool rtl)
{
double rect_w = DrawAreaWidth / rows;
double rect_h = DrawAreaHeight / columns;
base.Draw (gr, area_width, area_height, rtl);
for (int column = 0; column < columns; column++) {
for (int row = 0; row < rows; row++) {
gr.Rectangle (DrawAreaX + row * rect_w, DrawAreaY + column * rect_h, rect_w, rect_h);
if (row != 3 || column != 3) {
gr.DrawTextCentered (DrawAreaX + column * rect_w + rect_w / 2,
DrawAreaY + row * rect_h + rect_h / 2,
(numbers[column + (row * 4)]).ToString());
}
}
}
gr.DrawTextCentered (DrawAreaX + 3 * rect_w + rect_w / 2,
DrawAreaY + 3 * rect_h + rect_h / 2,
"?");
gr.Stroke ();
}
示例9: 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;
}
示例10: DrawSliceText
private static void DrawSliceText(CairoContextEx gr, double x, double y, int slice, string str1, string str2, string str3)
{
double x0, y0, degrees;
// Number more near to the center;
degrees = radian * (slice * ((360 / total_slices)) + (360 / 12));
x0 = 0.35 * radius * Math.Cos (degrees);
y0 = 0.35 * radius * Math.Sin (degrees);
gr.DrawTextCentered (x + x0, y + y0, str1);
// Number opposite to the center and at the top
degrees = radian * (slice * ((360 / total_slices)) + (360 / 24));
x0 = 0.8 * radius * Math.Cos (degrees);
y0 = 0.8 * radius * Math.Sin (degrees);
gr.DrawTextCentered (x + x0, y + y0, str2);
// Number opposite to the center and at the bottom
degrees = radian * (slice * ((360 / total_slices)) + (360 / 8));
x0 = 0.8 * radius * Math.Cos (degrees);
y0 = 0.8 * radius * Math.Sin (degrees);
gr.DrawTextCentered (x + x0, y + y0, str3);
}
示例11: DrawBar
static void DrawBar(CairoContextEx gr, double x, double y, double w, double h, double percentage)
{
double per = percentage / 100;
gr.Rectangle (x, y - h * per, w, h * per);
gr.FillGradient (x, y - h * per, w, h * per, new Cairo.Color (0, 0, 1));
gr.DrawTextCentered (x + w / 2, (y - 0.03) - h * per, String.Format ("{0}", percentage));
gr.Save ();
gr.Color = new Cairo.Color (0, 0, 0);
gr.MoveTo (x, y);
gr.LineTo (x, y - h * per);
gr.LineTo (x + w, y - h * per);
gr.LineTo (x + w, y);
gr.LineTo (x, y);
gr.Stroke ();
gr.Restore ();
}
示例12: Draw
public override void Draw(CairoContextEx gr, int area_width, int area_height, bool rtl)
{
StringBuilder sequence = new StringBuilder (64);
base.Draw (gr, area_width, area_height, rtl);
gr.SetPangoLargeFontSize ();
for (int num = 0; num < max_num - 1; num++)
{
if (num == question) {
sequence.Append ("?, ");
} else {
sequence.Append (numbers[num]);
sequence.Append (", ");
}
}
sequence.Append (numbers[max_num - 1]);
gr.DrawTextCentered (0.5, DrawAreaY + 0.3, sequence.ToString ());
}
示例13: Draw
public override void Draw(CairoContextEx gr, int area_width, int area_height, bool rtl)
{
double x = DrawAreaX + 0.22, y = DrawAreaY + 0.2;
double pos_x = x;
double pos_y = y;
Circle[] circles = null;
base.Draw (gr, area_width, area_height, rtl);
circles = new Circle [] {
new Circle (0.01, 0.06),
new Circle (0.27, 0.06),
new Circle (0.01, 0.21),
new Circle (0.27, 0.21),
new Circle (0.14, 0),
new Circle (0.14, 0.29)
};
// Circle
gr.Arc (pos_x + figure_size, pos_y + figure_size, figure_size, 0, 2 * Math.PI);
gr.Stroke ();
const double point_size = 0.01;
for (int i = 0; i < circles.Length; i++) {
gr.Arc (x + point_size + circles[i].x, y + point_size + circles[i].y, point_size, 0, 2 * Math.PI);
gr.Fill ();
gr.Stroke ();
}
gr.MoveTo (x + circles[2].x + 0.01, y + circles[2].y + 0.01);
gr.LineTo (x + circles[1].x + 0.01, y + circles[1].y + 0.01);
gr.Stroke ();
gr.DrawTextCentered (pos_x + figure_size, pos_y + 0.08 + figure_size * 2,
ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Two people in the table sitting across each other"));
}
示例14: Draw
public override void Draw(CairoContextEx gr, int area_width, int area_height, bool rtl)
{
double x = DrawAreaX + 0.05, y = DrawAreaY;
double pos_x = x;
double pos_y = y;
Circle[] circles = null;
base.Draw (gr, area_width, area_height, rtl);
// First circle
gr.Arc (pos_x + figure_size, y + figure_size, figure_size, 0, 2 * Math.PI);
gr.Stroke ();
DrawAndConnectPoints (gr, pos_x, pos_y,
new Circle [] {
new Circle (0.14, 0),
new Circle (0.14, 0.29),
}, true);
gr.DrawTextCentered (pos_x + figure_size, pos_y + figure_size * 2 + 0.07, HasNRegionString (2));
gr.Stroke ();
// Second circle
pos_x += 0.4;
gr.Arc (pos_x + figure_size, pos_y + figure_size, figure_size, 0, 2 * Math.PI);
gr.Stroke ();
DrawAndConnectPoints (gr, pos_x, pos_y,
new Circle [] {
new Circle (0.01, 0.06),
new Circle (0.27, 0.06),
new Circle (0.14, 0.29),
}, true);
gr.DrawTextCentered (pos_x + figure_size, pos_y + figure_size * 2 + 0.07, HasNRegionString (4));
gr.Stroke ();
// Third circle
pos_x = x;
pos_y += 0.45;
gr.Arc (pos_x + figure_size, pos_y + figure_size, figure_size, 0, 2 * Math.PI);
gr.Stroke ();
DrawAndConnectPoints (gr, pos_x, pos_y,
new Circle [] {
new Circle (0.01, 0.06),
new Circle (0.27, 0.06),
new Circle (0.01, 0.21),
new Circle (0.27, 0.21),
}, true);
gr.DrawTextCentered (pos_x + figure_size, pos_y + figure_size * 2 + 0.07, HasNRegionString (8));
gr.Stroke ();
switch (dots) {
case 5:
circles = new Circle [] {
new Circle (0.01, 0.06),
new Circle (0.27, 0.06),
new Circle (0.01, 0.21),
new Circle (0.27, 0.21),
new Circle (0.14, 0),
};
break;
case 6:
circles = new Circle [] {
new Circle (0.01, 0.06),
new Circle (0.27, 0.06),
new Circle (0.01, 0.21),
new Circle (0.27, 0.21),
new Circle (0.14, 0),
new Circle (0.14, 0.29)
};
break;
}
// Forth circle
pos_x += 0.4;
gr.Arc (pos_x + figure_size, pos_y + figure_size, figure_size, 0, 2 * Math.PI);
gr.Stroke ();
DrawAndConnectPoints (gr, pos_x, pos_y, circles, Answer.Draw);
}
示例15: Draw
public override void Draw(CairoContextEx gr, int area_width, int area_height, bool rtl)
{
double x = DrawAreaX + 0.1;
base.Draw (gr, area_width, area_height, rtl);
gr.SetPangoLargeFontSize ();
gr.MoveTo (x, DrawAreaY + 0.22);
gr.ShowPangoText (String.Format ("number1 + number2 = {0}", op1));
gr.MoveTo (x, DrawAreaY + 0.44);
gr.ShowPangoText (String.Format ("number1 * number2 = {0}", op2));
gr.Color = new Color (0.9, 0.9, 0.9);
gr.DrawTextCentered (0.5, DrawAreaY, "This is an extension sample");
}