*Experts* Bucky Posted April 24, 2003 *Experts* Posted April 24, 2003 I have a handle to a window that's been drawn on by various Windows APIs. I can create a Graphics object and paint to it fine. How can I save the contents of the Graphics object (or directly from the hDC, if that makes a difference) to a file? Quote "Being grown up isn't half as fun as growing up These are the best days of our lives" -The Ataris, In This Diary
*Experts* Nerseus Posted April 24, 2003 *Experts* Posted April 24, 2003 I think you'll need to create an appropriately sized Bitmap object and use the Graphics object's DrawImage method to draw the image to the Bitmap. Then use the Bitmap's Save method to write it out. It can write to various formats using the ImageFormat param (I think). -Nerseus Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
*Experts* Bucky Posted April 26, 2003 Author *Experts* Posted April 26, 2003 The problem there is that DrawImage only takes classes inherited from Image (such as Bitmap) as a parameter; you can't pass a Graphics object to DrawImage. Herein lies the problem. I tried using BitBlt from the DC to the DC of a Bitmap's Graphics object, but without luck. Quote "Being grown up isn't half as fun as growing up These are the best days of our lives" -The Ataris, In This Diary
*Gurus* divil Posted April 26, 2003 *Gurus* Posted April 26, 2003 Data on a DC isn't strictly saved anywhere, it's often just drawn straight on to screen memory when needed. If bltting from the DC didn't work I don't know what to suggest. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.