need help going from Graphics to Image

  • Thread starter Thread starter not_a_commie
  • Start date Start date
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.
 
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
 
Back
Top