Jimmy
Jimmy

Reputation: 13

Copy Form's image to bitmap in memory

How can I copy the image in the clientrectangle of my form to a bitmap in memory? I know how to go from bitmap to form, but not the other way around. Thanks!

Upvotes: 1

Views: 2069

Answers (2)

Hans Passant
Hans Passant

Reputation: 941635

You can use the DrawToBitmap() method. Mostly works, but you might have controls that don't implement it, like RTB or 3rd party controls. The backup method is Graphics.CopyFromScreen().

Upvotes: 1

Mark H
Mark H

Reputation: 13897

Assuming you're referring to the BackgroundImage property of the form.

var bmp = ((Bitmap)this.BackgroundImage);

Upvotes: 0

Related Questions