I was following this article and I got my canvas to be saved, however, I want to extend the code’s functionality and save a particular part of my canvas as an image, rather than my entire canvas.
I tried setting the rect.Offset and rect.Location properties but the image is always saved from the upper left corner of my canvas.
Does anyone know how can I achieve my wanted functionality in a similar way?
Thanks!
A simple method would be to use a
CroppedBitmapafter rendering the whole canvas. You could reuse the sameRenderTargetBitmap, if you need multiple images.If you want to save to a bitmap object instead of a file, you can use: