Dont create the font on a loop
svn path=/trunk/gtk-sharp/; revision=28714
This commit is contained in:
parent
03df165143
commit
c06d83388c
1 changed files with 4 additions and 4 deletions
|
@ -91,11 +91,13 @@ class PrettyGraphic : DrawingArea {
|
|||
|
||||
class MovingText : DrawingArea {
|
||||
static int d = 0;
|
||||
Font f;
|
||||
|
||||
public MovingText ()
|
||||
{
|
||||
Gtk.Timeout.Add (50, new Function (Forever));
|
||||
Gtk.Timeout.Add (20, new Function (Forever));
|
||||
SetSizeRequest (300, 200);
|
||||
f = new Font ("Times", 20);
|
||||
}
|
||||
|
||||
bool Forever ()
|
||||
|
@ -112,7 +114,6 @@ class MovingText : DrawingArea {
|
|||
using (Graphics g = Gdk.Graphics.FromDrawable (args.Window)){
|
||||
using (Brush back = new SolidBrush (Color.White),
|
||||
fore = new SolidBrush (Color.Red)){
|
||||
using (Font f = new Font ("Times", 20)){
|
||||
|
||||
g.FillRectangle (back, 0, 0, 400, 400);
|
||||
g.TranslateTransform (150, 100);
|
||||
|
@ -121,7 +122,6 @@ class MovingText : DrawingArea {
|
|||
g.DrawString ("Mono", f, fore, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue