Gtk# animation
Information for anyone, who is looking for solution to not-refreshing DrawingArea on google and is finding only questions about it :)
You shouldn’t touch DrawingArea from anything else than original gtk/glib thread. That means doing:
drawingArea.QueueDraw(); // or drawingArea.GdkWindow.ProcessUpdates(...); // and others
from System.Threading.Timer callback won’t do any good. Window may start updating in the first case after resizing of the window, and update only while resizing in second case, but that’s probably undefined random behaviour. Proper way to handle refreshing (as far as information from different mailing lists put together suggest) is:
uint animationTimer = GLib.Timeout.Add(
milisecs,
new GLib.TimeoutHandler(onAnimationTimer));
...
bool onAnimationTimer() {
drawingArea.QueueDraw();
return true;
}
Hope that helps if you were trying to achieve animation.
Leave a comment