Using Graphics: Making a Lander Game
Start up VB and make a new 'Standard EXE' project. On Form1 put two picture boxes of similar size, and into Picture1, load up a picture of your pet or favourite theme park or maybe just the Windows' clouds! Make sure that both boxes are big enough to hold this picture. Also, place two command buttons on the form.
Set the caption of the first command button to 'Copy'. In the click event of this command button, place this code:
Private Sub Command1_Click() Picture1.ScaleMode = vbPixels Picture2.ScaleMode = vbPixels BitBlt Picture2.hDC, 0, 0, Picture2.ScaleWidth, _ Picture2.ScaleHeight, Picture1.hDC, 0, 0, _ vbSrcCopy End Sub
Set the caption of the second command button to 'Invert', then put this code into the click event:
Private Sub Command2_Click() BitBlt Picture2.hDC, 0, 0, Picture2.ScaleWidth, _ Picture2.ScaleHeight, Picture2.hDC, 0, 0, _ vbDstInvert End Sub
Now, fire up your program, and click on the buttons a few times....it may not quite be Paint Shop Pro, but the effect is peculiarly hypnotic! Have a play around, and see if you can get just bits of the image to invert. This is my offering:
Page 3 of 8