Walk Lightly on this PLANET and yet leave such a FOOTPRINT that cannot be erased for thousands of Years..!!!
Visit Codstech for Cyber Security related Posts !

Visitors

Monday, June 27, 2011

VB-23 : Simple Animation using ActiveX

Program for implementing a small animation clip in an application :


Steps:


  1. Start VB
  2. Project --> Components (Ctrl T)
  3. Add a component file comct232.ocx to the project from control tab in the window.(Select "Microsoft windows common controls-2.5.0(SP2))
  4. Apply-OK
  5. We will get two new controls in the tool box(up-down control and animation control)
  6. Now, add the animation control in our form
  7. Add two command buttons in our form and set their caption property as Play and Stop
  8. Again , Project --> Components (Ctrl T)
  9. Add a component file comdlg32.ocx to the project from control tab in the window.(Select "Microsoft common dialog controls-6.0(SP6))
  10. Apply-OK
  11. Now, add this new control in our form.
Now run the program and you will get the following screen.


(The other two controls Animation and CommonDialog will not appear on the screen while running)


Attaching Code to the Object :



Private Sub Command1_Click()
CommonDialog1.Filter = "*.AVI"
CommonDialog1.ShowOpen
Animation1.Open CommonDialog1.FileName
Animation1.Play
End Sub
Private Sub Command2_Click()
Animation1.Stop
End Sub


Output :


When you press PLAY , a screen will appear ,open any file with AVI format.And you will get the same loaded form with a new running animation file which you have choosen.
To stop animation,you can press STOP button.


(Refer this Video explaining a simple animation)
=========================================================================
Back to Home   &  VB

No comments: