I have a Graphics object that I’ve drawn on the screen and I need to save it to a png or bmp file. Graphics doesn’t seem to support that directly, but it must be possible somehow.
What are the steps?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Copy it to a
Bitmapand then call the bitmap’sSavemethod.Note that if you’re literally drawing to the screen (by grabbing the screen’s device context), then the only way to save what you just drew to the screen is to reverse the process by drawing from the screen to a
Bitmap. This is possible, but it would obviously be a lot easier to just draw directly to a Bitmap (using the same code you use to draw to the screen).