I use the following code to create a surface from a file:
The code works fine the first time round. However when I run it the second time in the life time of the program (with a different file), the dimensions of imgDesc (lwidth and lheight) don't seem to change at all...they remain in the same dimensions as the first picture loaded. I'm probably missing something to reset the surface or something similar, but I have no idea what it is!Code:Public imgDesc As DDSURFACEDESC2 'image surface description 'in a sub imgDesc.lFlags = DDSD_CAPS imgDesc.ddsCaps.lCaps = DDSCAPS_OFFSCREENPLAIN Set imgBuffer = DDraw.CreateSurfaceFromFile(FileName, imgDesc) 'change the size of the picture box so it is the same size as the picture picMain.Width = picMain.ScaleX(imgDesc.lWidth, vbPixels, vbTwips) picMain.Height = picMain.ScaleY(imgDesc.lHeight, vbPixels, vbTwips) 'then the blitting is done




Reply With Quote