How to take screenshot of window scroll in c #

What is the easiest way to take a screenshot of a full scroll window in C #?

I have use cases here using a web browser, but in this case this window is a Windows desktop application.

+4
source share
3 answers

I solved this using the Win API and taking some screenshots, scrolling between them and then combining them.

0
source

You can get windows to redirect WM_PAINT to off-screen buffers with WM_PRINT and WM_PRINTCLIENT. This is better than scripting because it ensures that the shaded parts of the window (behind other windows) are painted anyway. If your target window scrolls by scrolling the position of the child window, WM_PRINT should be applied. Just maybe this will also help your scenario.

+1
source

Only 3 lines of code are enough

Bitmap b = new Bitmap(pnlOuter.Width, pnlOuter.Height); pnlOuter.DrawToBitmap(b, new Rectangle(0, 0, pnlOuter.Width, pnlOuter.Height)); b.Save("D:\\bitmapImage.jpg"); 

pnlOuter is a panel that contains all the controls that must be displayed on an image with an extended height to contain all the internal controls. In the contained form, scroll bars may be included.

0
source

Source: https://habr.com/ru/post/1396672/


All Articles