This is a simple animation program where you can move the picture in any four directions by clicking the relevant button. In this program, you need to insert four timers and make them invisible and set the enabled property to false at start-up. Insert the move_up, move_down, move_left and move_right procedures into the respective timers as shown in the code. Use the move method and the computer coordinates system Left, Top to change the positions of the image. This program could be used to create various games later on. The basic syntax of the Move method is object.move Left, Top . For example, Image1.Move 1000,1000 will move the object Image1 to the location (1000,1000). We have also created four sub procedures Move_up, Move_down, Move_left and Move_right to move the image in the respective directions.
[Back to Sample VB Programs]
Copyright ® 2008 Dr.Liew Voon Kiong . All rights reserved |Contact: firstname.lastname@example.org