Very OT - VisualBasic SavePicture

Chienworks wrote on 1/23/2003, 4:16 PM
Not Vegas related at all, but there's lots of bright folks who visit here, and since we're talking about scripting these days i thought this might get an answer.

I've been working on some software to generate animated displays and would like to output them as a sequential series of images which could be imported into Vegas. I have no trouble generating the frames in a VisualBasic picturebox control. I should then be able to use the SavePicture method to output each frame to a .bmp file. However, this process crashes unless i first load a .bmp file into the control, so i created a black bitmap image of the proper size and load that. The problem with this is that all that saves is the original picture that was loaded instead of the new frame i've generated. I do have autoredraw set to true for the picturebox control. I'm confused. Any ideas?

If anyone is really curious, i have a very simple animated snowflake generator i've written here:
http://www.chienworks.com/software/snowflake/

Thanks for any suggestions!

Comments

Paul_Holmes wrote on 1/23/2003, 5:01 PM
It's been so long since I've used VB and have used Delphi until recently, but is it possible you're supposed to be drawing to the "canvas" and not the bitmap. Sorry if this doesn't apply. I'm too steeped in Delphi terminology now.
Chienworks wrote on 1/23/2003, 5:20 PM
Paul, thanks for the idea. Those terms aren't used in VB, but i assume that means drawing just on the screen view vs. drawing on the data object itself. From what i understand of the manual, setting auto redraw to true is supposed to accomplish this. For what it's worth, i get the same (non)result setting it to either true or false.

*sigh* VB 3 was so simple and easy. VB 6 is now part of VisualStudio and i just don't understand it anymore ;)
southside_g wrote on 1/23/2003, 5:37 PM
I do a lot of VB6 work, but must admit to not having had the opportunity to use the PictureBox.SavePicture method yet. I do not have a specific answer for you, but I do have a suspicion on which direction you may need to go.

I suspect that you may have to go with some API memory handles (something along the lines of some CopyPtrToMemory or CopyBitmap routines) to physically move the picturebox data from memory to a file at a lower level.

HTH, but also hope there is an easier solution for you ;)

G.

Paul_Holmes wrote on 1/23/2003, 5:58 PM
Well, I sympathise. In the past I've done a lot of work with loading, saving and changing bitmaps and many a time I've been snagged for a few days until finally the light would dawn, some web post would enlighten me, and I'd get it right. I do like VB, very easy to use but I understand that the chief architect of Delphi is now the chief architect of VB and has made it object-oriented, thus changing a lot of things around.
mikkie wrote on 1/24/2003, 10:55 AM
I haven't done any codeing for years, possibly a decade, so please forgive if this sounds terminally stupid...

Skimming through the winmedia & realmedia SDKs a good while back I seem to remember them having quite a bit of VB stuff to incoporate if you were building editing capabilities into your software. Is it possible there's a snippet or two of code there that might help?

mike
jetdv wrote on 1/24/2003, 1:33 PM
How about:


SavePicture Form1.bmp.Image, "c:\MyFile.bmp"