1

I have a windows form application.

The form is large & has scroll bars to view its entire content.

I need to take the screen shot of the entire form(including the area which is outside of screen due to the forms height).

I tried following code, but it captures only the part of the form which is visible on screen:

ScreenCapture sc = new ScreenCapture();
// capture entire screen, and save it to a file
Image img = sc.CaptureScreen();
// display image in a Picture control named imageDisplay
this.imageDisplay.Image = img;
// capture this window, and save it
sc.CaptureWindowToFile(this.Handle,"C:\\temp2.gif",ImageFormat.Gif);

I am not able to take screen shot of the entire Form.

Can anybody please let me know the way to capture the entire form including the area which is hidden due to scroll?

Andrea
  • 11,801
  • 17
  • 65
  • 72
  • I don't think there's an *automatic* way of doing it. You'll have to construct the image manually, i.e. paint each and every control in the image yourself in code. – System Down Nov 13 '13 at 21:44
  • There is no magic bullet, but there is an idea of mine. You can take those pictures based on scrolled amount of the form. For example, you can first take the first half and then scroll to second half and take the rest. You have to divide the entire form's content height by the visible area height so you can know how much do you need to scroll every time. – MahanGM Nov 13 '13 at 22:17
  • Thanks for the reply ... do u mean that . i need to first take the screen shot of the visible region & then scroll down(using code) & again take the screen shot.. & then merge the two screen shots?? – user2989602 Nov 14 '13 at 01:12

2 Answers2

0

Consider drawing the screen to a bitmap: http://msdn.microsoft.com/en-us/library/system.windows.forms.control.drawtobitmap.aspx

There are some limitations though, the maximum size might be constrained and drawing a rich text box does not work.

Bas
  • 26,772
  • 8
  • 53
  • 86
0

Did you try using Control.DrawToBitmap you can use it on the form as well as specific controls in the form.

peter
  • 14,348
  • 9
  • 62
  • 96