Does anyone know how to take a screenshot using C# and limit it to take a picture of a specific container/portion of an application. I do not want the whole screen or whole window of the application.
My Panel is simply called: panel1 User would click a "button" and take screenshot of panel1 and attach to email.
I would like to take a screen shot of that section only and then save locally to the C:\ Drive and/or attach or embed into an outlook email.
I read other various things on the internet but most of them had to deal with creating complex changes in take a screenshot of a web browser control which I am not looking for.
Slight modification of Killercam's answer:
This method will take screenshot immediately. For example, if you change visibility of a button within the panel just before calling this function, the bitmap will contain the button. If this is not desired, use keyboardP's answer.
I've found this to save a control as bitmap:
I've found something about outlook here, but I couldn't test it, because I don't have outlook installed on my PC.
If you just want to the
Panel's
screenshot, you can use the built-in DrawToBitmap method.Just note that some controls may not work with this functionality such as the
WebBrowser
andRichTextBox
controls but it should work for most other controls (textbox, labels etc..)An improvement to Asif´s answer:
I do this using something like
I hope this helps