[Mono-list] Double-buffered graphics solutions in mono

Stuart Ballard sballard@netreach.com
Thu, 12 Feb 2004 12:26:33 -0500


I'm looking for a way to do a simple double-buffered graphics display 
that will work with Mono on Linux.

I know how to do it (at least so it works, even if I'm not doing it 
"right") in WinForms, but I heard that WinForms is currently just broken 
in Mono, and besides, it's not the world's most elegant GUI toolkit anyway.

I'm thinking that GTK# is probably the way to go, but I'm not sure where 
to start looking for documentation on how to do what I'm trying to do, 
because I imagine that in the C world the things I need are more 
GDK/Cairo level than GTK+ itself. At this point, what I need is:

- Create a window that contains a drawable area (ideally leaving some 
space outside the drawable area that I can put normal controls into later)
- Draw geometric shapes (circles and lines) into that drawable area
- Swap out one frame and swap in a new one with the circles and lines in 
a new position, flicker-free

In WinForms I was able to do this by creating a PictureBox, drawing to 
an Image offscreen, and then swapping it in by the Image property of 
PictureBox. I'm not sure if this is the right way, but it worked. 
Essentially I was doing the double-buffering entirely manually.

On Mono, I'm not sure how System.Drawing.Image would integrate with 
GTK#, or whether I even want it to - perhaps there's a better way of 
doing double-buffered drawing in a GTK# environment. But I don't even 
know whether I should start looking in the GTK# docs, or the GTK+ docs, 
or the GDK docs.

If anyone could give me some tips, or better yet, suggest a sample 
application which does vaguely what I'm looking for that I could look at 
the sample code of, I'd really appreciate it. I'd like something that's 
actually going to work with recent mono, despite the 
libgdiplus/Cairo/System.Drawing/WinForms upheaval - or better yet, work 
with the Jan 14th snapshots as packaged in Debian, which *do* include 
GTK# :)

Stuart.
-- 
Stuart Ballard, Senior Web Developer
NetReach, Inc.
(215) 283-2300, ext. 126
http://www.netreach.com/