Quantcast
Channel: VBForums - CodeBank - Visual Basic 6 and earlier
Viewing all articles
Browse latest Browse all 1529

How To Move An Image Using BitBlt

$
0
0
This simple example shows you how to move an image across a canvas using BitBlt API. This example uses a Picturebox control where you move the image using the command buttons or the up, down, left, and right keyboard keys.

The basic steps to move an image are:

1) Save the rectangle area from the Picturebox the size of the rectangle of the original image.

2) BitBlt the original image from it's source to that area on the Picturebox. It is better to use TransparentBlt instead of BitBlt because it does not require that you use masking to make image transparent.

3) Restore the area that was saved

4) Set next position

5) Save the area that represents the next position you want to move the image to

6) BitBlt image to next position

Repeat at Step 3

The attached project use this method.
Attached Files

Viewing all articles
Browse latest Browse all 1529

Trending Articles