[Mono-winforms-list] Window Capture
yom
guillaume.bibaut at gmail.com
Sat Oct 22 10:06:33 EDT 2005
Hi,
I've recently found a way to get a window capture with C# on the .NET
1.1Framework using Message class and WndProc method. While on Windows
it
returns me the bitmap of the window, with Mono on Linux, I'm just getting an
empty bitmap (black bitmap, no window drawing). Is it the normal behavior ?
the following source code is a click on a button on a form.
## CODE ##
Bitmap inter = new Bitmap(this.Width, this.Height);
Graphics gfxInter = Graphics.FromImage(inter);
IntPtr hInter = gfxInter.GetHdc();
// Complete Window Capture
Message msg = new Message();
msg.Msg = WM_PRINT;
msg.HWnd = this.Handle;
msg.WParam = hInter;
msg.LParam = new IntPtr(PRF_CLIENT | PRF_CHILDREN | PRF_NONCLIENT |
PRF_ERASEBKGND);
this.WndProc(ref msg);
gfxInter.ReleaseHdc(hInter);
gfxInter.Dispose();
inter.Save("test.jpg", ImageFormat.Jpeg);
## CODE ##
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-winforms-list/attachments/20051022/c83009c0/attachment.html
More information about the Mono-winforms-list
mailing list