19-06-2006, 04:16 PM
No, the way it is currently setup, it does not place the data from memory to a picturebox.
Just a little information, this will greatly increase your executable size. If you don't care just keep reading.
Add this sub to your project.
And from your initsurfaces sub, make sure you change where it loads from file to this:
Ok, now on the form where the pictureboxes are, make sure both the form and the pictureboxes scalemode are pixels. Set the pictureboxes autoredraw to true.
[edit]Oh and forgot to mention, after you've loaded all the images you want from the pictureboxes. I would also suggest doing the following:
Just so you don't have multiple copies of the image in memory.[/edit]
Just a little information, this will greatly increase your executable size. If you don't care just keep reading.
Add this sub to your project.
Code:
Public Sub LoadFromPictureBox(DDSURF As DirectDrawSurface7, pBox As PictureBox)
Dim DC As Long
Dim DDSD As DDSURFACEDESC2
Dim Key As DDCOLORKEY
With DDSD
.lFlags = DDSD_CAPS Or DDSD_WIDTH Or DDSD_HEIGHT
.ddsCaps.lCaps = DDSCAPS_OFFSCREENPLAIN Or DDSCAPS_VIDEOMEMORY 'or DDSCAPS_SYSTEMMEMORY whichever you prefer
.lHeight = pBox.Height
.lWidth = pBox.Width
End With
Set DDSURF = DD.CreateSurface(DDSD)
DC = DDSURF.GetDC
BitBlt DC, 0, 0, pBox.Width, pBox.Height, pBox.hdc, 0, 0, vbSrcCopy
DDSURF.ReleaseDC DC
DDSURF.SetColorKey DDCKEY_SRCBLT, Key
End Sub
And from your initsurfaces sub, make sure you change where it loads from file to this:
Code:
Call LoadFromPicturebox(thesurf, frmWhatever.pb)
Ok, now on the form where the pictureboxes are, make sure both the form and the pictureboxes scalemode are pixels. Set the pictureboxes autoredraw to true.
[edit]Oh and forgot to mention, after you've loaded all the images you want from the pictureboxes. I would also suggest doing the following:
Code:
frmWhatever.pb.Picture = Nothing
Just so you don't have multiple copies of the image in memory.[/edit]