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
|