I've recently found a way to get a window capture with C# on the .NET 1.1 Framework 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 ##
_______________________________________________ Mono-winforms-list maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-winforms-list
