本文整理汇总了C#中gbrainy.Core.Main.CairoContextEx.DrawBackground方法的典型用法代码示例。如果您正苦于以下问题:C# CairoContextEx.DrawBackground方法的具体用法?C# CairoContextEx.DrawBackground怎么用?C# CairoContextEx.DrawBackground使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gbrainy.Core.Main.CairoContextEx
的用法示例。
在下文中一共展示了CairoContextEx.DrawBackground方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}