On 23.07.2011 03:04, killer1390 wrote:
> Plain and simple. I would like to be able to take a screen shot which I can
> then place inside a picturebox. The closest I have come to is this:
> http://stackoverflow.com/questions/5243021/how-to-take-screenshot-from-panel-in-mono-c
> Link
>
> This would work, but it doesn't resize, and it is really slow to do it.
> Is there a better way?

Slow? Doesn't resize? Are we looking at the same code snippet?

Anyway, since PictureBox is a WinForms control, you can take screenshots
using Graphics.CopyFromScreen, like under Windows:

var screenRect = Screen.FromControl (this).Bounds;
var bitmap = new Bitmap (screenRect.Width, screenRect.Height);
using (var g = Graphics.FromImage (bitmap)) {
        g.CopyFromScreen (
                screenRect.Left, screenRect.Top,
                0, 0,
                screenRect.Size);
}
pictureBox.Image = bitmap;


Robert

_______________________________________________
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list

Reply via email to