Take a screenshot from WPF

Can I take a screenshot of a single item in a WPF form? I need to take a screenshot with the border tool and its child.

+4
source share
2 answers

given the source as the item you want to capture from the screen. This is the code that I have that saves it to the clipboard.

RenderTargetBitmap bmp = new RenderTargetBitmap((int)source.ActualWidth, (int)source.ActualHeight, 96, 96, PixelFormats.Pbgra32); bmp.Render(source); Clipboard.SetImage(bmp); 
+2
source

You can use RenderTargetBitmap for rendering, if you are looking for it on SO, there should be some questions that help if the link is not enough.

Further this external article may help.

+1
source

All Articles