need help going from Graphics to Image

N

not_a_commie

I recognize that the need for this spells a serious flaw in the
program design, but I need to copy a portion out of a Graphics object
and put that into an Image object. How do I do it generically? I have
some existing code that does it using BitBlt from a DLLImport, but I
want to take this cross-platform. Thanks for your time.
 
M

Michael Phillips, Jr.

In GDI the device context represents the "drawing surface". In .Net the
Graphics object represents the "drawing surface".

In GDI, you create a destination image and select it into a memory device
context and use BitBlt to draw all or part of one source image to your
destination image.

In .Net, you create a destination Bitmap object and then create a Graphics
object from this bitmap. This Graphics object represents your destination
"drawing surface".

You then use DrawImage to draw all or part of your source image to your
destination image.

See MSDN online for example code or check out Bob Powell's sites for example
code:

http://www.bobpowell.net/faqmain.htm

http://www.bobpowell.net/tipstricks.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top