In this section, we will show you how to move an object by pressing a command button. You need to make use of the Top and Left properties of an object to create animation. The Top property defines the distance of the object from the top most border of the screen while the Left property defines the distance of the object from leftmost border of the screen. By adding or subtracting the distance of the object we can create the animated effect of moving an object.
Start a new project and name it as Movable Object, or any name you wish. Now insert a PictureBox and in its Image property import a picture from your hard drive or other sources. Next, insert four command buttons, change their captions to Move Up, Move Down, Move Left and Move Right. Name them as MoveUpBtn, MoveDowbBtn, MoveLeftBtn and MoveRightBtn.
Learn animation in Vb2010:
We have added yet another new lesson in our Visual Basic 2010 tutorial. In this new lesson, we show you how to create animation in Visual Basic 2010. Click on the link below to check it out.
http://www.vbtutor.net/vb2010/vb2010_Lesson28.htm
No comments:
Post a Comment