DotNet Screenshot
Dot Net WebBrowser control screenshots
One of my side projects consists of taking screenshots of webpages.
The application I have created is a WinForm application in .Net 7, I have been using DrawToBitmap()
method, and this works fine for some controls.
… but not for the WebView
Control !
HEre is the solution I have found to solve the issue.
System.Drawing.Graphics class
The code below takes a screenshot of an area of the screen.
The trick is to make the area match with the control you want to take the picture of.
In my case, pCapture is the control containing everything I want to get in the Picture.
The PointToScreen()
method gives me the absolute coordinate of the pCapture Control.
|
|