Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
 
 
 
500MB 27GB Web Hosting - $9.95/Month
 
 
 
 
 
Old Pages
 
Old Index
Site Map
What's New
 
Books
How To
Tips & Tricks
Tutorials
Stories
Performance
Essays
Links
Q & A
New in VB6
Free Stuff
Pictures
 
 
 
TitleAnimate a complex moving object
Keywordsoverlay, moving object, moving picture, transparent picture
CategoriesMultimedia, Graphics
 
Use the BitBlt API function.

The original version of this example used two PictureBoxes to hold the images. In this updated version, only one PictureBox holds the image initially. The program's Load event handler copies the image into the other PictureBox.

This saves space in the compiled executable, the .frx file, and thus the Zip file.

 
' Draw the picture at (CurX, CurY).
Private Sub DrawPicture()
    ' Fix the part of the image that was covered.
    BitBlt picCanvas.hDC, _
        OldX, OldY, PicWid, PicHgt, _
        picHidden.hDC, OldX, OldY, SRCCOPY
    OldX = CurX
    OldY = CurY

    ' Paint on the new image.
    BitBlt picCanvas.hDC, _
        CurX, CurY, PicWid, PicHgt, _
        picXMask.hDC, 0, 0, MERGEPAINT
    BitBlt picCanvas.hDC, _
        CurX, CurY, PicWid, PicHgt, _
        picX.hDC, 0, 0, SRCAND

    ' Update the display.
    picCanvas.Refresh
End Sub
 
 
Copyright © 1997-2003 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated