Here's how to do it exactly.  I have tested this and it works:

// holder variables
int width = 0;
int height = 0;

// get the root window
// NOTE: if you have multiple monitors, this may not grab the correct root
window
// or it may grab the entire desktop if it is stretched over multiple
screens (a la xinerama)
// there are ways to enumerate the screens and pick the one you want...
Gdk.Window root = Gdk.Global.DefaultRootWindow;

// get its width and height
root.GetSize(out width, out height);

// create a new pixbuf from the root window
Gdk.Pixbuf screenshot = Gdk.Pixbuf.FromDrawable(root, root.Colormap, 0, 0,
0, 0, width, height);

// save it
screenshot.Save("~/screenshot.png", "png");

// or do whatever you want with it...


Dave
_______________________________________________
Gtk-sharp-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list

Reply via email to