[Gtk-sharp-list] grabbing a screenshot from C#?

David Huseby dave at linuxprogrammer.org
Fri Apr 6 12:18:41 EDT 2007


Nvrmnd, I figured it out.  But for those of you who are interested in how
you do that, there is a Gdk.Global class that has a property called
DefaultRootWindow.

So I think the way to take a screenshot is to do something like this:

int width = 0;
int height = 0;

// get the root window
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.GdkPixbuf screenshot = Gdk.GdkPixbuf.CreateFromDrawable(root,
root.Colormap, 0, 0, 0, 0, width, height);

Dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/gtk-sharp-list/attachments/20070406/369c77cd/attachment.html 


More information about the Gtk-sharp-list mailing list