The Image control has a stretch property that will automatically stretch the picture to fit the control, but the PictureBox doesn't have this. To stretch the image, use the StretchBlt API:
Public Declare Function StretchBlt Lib "gdi32" Alias "StretchBlt" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long
Notes on the arguments:
hdc and hSrcDC are the Device Context handles of the source and destination pictures (Picture1.hDC, Form1.hDC, etc.)
dwRop is the raster operation, a direct copy is vbSrcCopy.
As far as transparent, do you want the entire image to fade into the background or to have a transparent backcolor? For a transparent backcolor (only the image is drawn, not the whole square), you'll need to do a couple things, and it gets a little complicated:
First create a "mask" bitmap for each "sprite" you want to make. The mask is usually a white background with a black silhouette of the image, kind of like a negative of the real image.
Second, you'll have to use different raster operations in the StretchBlt (or BitBlt, or the Picture1.PaintPicture method) to create the sprite.
The easiest way I've found to do this is to have your source bitmaps (mask and origional) stored into pictureboxes on their own form that never gets displayed to the user (this increases the size of the exe, but it's fast). You should also have a buffer picture box where you'll build the image before vbScrCopy'ing the result to the destination picturebox. Say you have picMask, picImage, picBuffer, and picDest. picMask and picImage contain the mask and origional image, respectively, on the hidden form. If the mask image is white with a black silhouette, you can use these raster operations to create a sprite on the buffer:
vbMergePaint from picMask.hDC to picBuffer.hDC
vbSrcAnd from picImage.hDC to picBuffer.hDC (at the same x,y coordinates, same Height/Width, etc.)
At this point you should have your sprite build on the buffer, you can just source copy from the buffer to the destination:
vbSrcCopy from picBuffer.hDC to picDest.hDC
This is 3 separate calls to StretchBlt to make your sprite and copy the result to the UI.
I've left out the x, y, Width, and Height arguments, those should be the easy ones.
A couple other raster operations you may play with are vbPatInvert and vbSrcPaint. Others can be found on various websites, but what you have here should do the trick.
-Hope that helps!
-Mike
Difference between a madman and a genius:
A madman uses his genius destructively,
A genius uses his madness constructively.