I currently have a winform that, during run time, I need to take a screenshot of a section of it and save it as an image. In particular, I want a screenshot of a panel called "panel1". I've been able to find information on how to get screenshots of entire webforms, or entire screens... but I've had difficulty finding info on getting just a portion of the screen.
Does anyone have any information that could point me in the right direction? Even the name of the documentation on MSDN's site that I should be looking for would be a huge help! Thanks!
The
Control
class from whichPanel
derives has a methodDrawToBitmap()
. You can use that.http://msdn.microsoft.com/en-us/library/system.windows.forms.control.drawtobitmap.aspx
Look at the documentation for Graphics.CopyFromScreen. You pass it 2 sets of X/Y coordinates - the coordinates on the screen and the coordinates within your bitmap.