views:

40

answers:

1

I have a .NET program that does some displaying by drawing on a system.drawing.drawing2d.graphics object. I'd like to be able to turn each "frame" drawn into a frame in an .avi file.

Are there AVI classes in .NET? Some simple way to get the bitmap that must underlie the graphics object?

Thanks in advance.

A: 

Should be easy enough to draw a bitmap in the same way that you are drawing on the graphics surface at the moment; an example of creating a graphics object from a bitmap can be found over on MSDN. You could draw each bitmap image, display it on the graphics surface then write the bitmap to a file for later use.

A quick search also yielded this codeproject tutorial which has an example of generating an AVI from a set of bitmaps in C#.

Another example of this can be found in the AVIWriter class.

Either of these examples could be modified to read your list of bitmaps generated in the drawing phase of your code and then generate the AVI.

Hope this helps!

mdm