Taking Bitmap snapshot of a from or a control on a form

  • Thread starter Thread starter Sajjad
  • Start date Start date
S

Sajjad

i have one application running remotly and want to take its window snapshort
at any given time,
Here is a code i wrote

public Bitmap GetPicture()

{

Bitmap sbmp = new Bitmap(1000, 1000);

Graphics g = Graphics.FromImage( sbmp );

System.Windows.Forms.PaintEventArgs pe = new PaintEventArgs(g, new
Rectangle(0, 0, 1000, 1000));

this.InvokePaint(this.picturebox, pe);

g.Dispose();

return sbmp;

}



problem with this code is that it works fine with picture box, but if i
specify this (current form) or any user control or IE webBrowser control i
dont get any thing back its just blank.

requirment is that it should be able to get snapshot even window is
minimized (or even hidden).

Thanks,

Sajjad
 
Try sending a WM_PRINT message to the control. If it supports the message,
it will print itself to the DC

Atul Godbole
http://www.ssware.com/
Shell MegaPack - Windows Explorer Shell Controls for ActiveX and .Net
 
do you have idea how can i do it from within .net
Atul Godbole said:
Try sending a WM_PRINT message to the control. If it supports the
message, it will print itself to the DC

Atul Godbole
http://www.ssware.com/
Shell MegaPack - Windows Explorer Shell Controls for ActiveX and .Net
 
Hi Sajjad,

Does my reply make sense to you? Is your problem resolved? Please feel free
to tell me, thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Back
Top