Presentation is loading. Please wait.

Presentation is loading. Please wait.

Multimedia ! Graphics ! Animation ! Sound Tip Of the Day 4 Tip of the Day: When using graphic methods at Form Load, the AutoRedraw property of the container.

Similar presentations


Presentation on theme: "Multimedia ! Graphics ! Animation ! Sound Tip Of the Day 4 Tip of the Day: When using graphic methods at Form Load, the AutoRedraw property of the container."— Presentation transcript:

1

2 Multimedia ! Graphics ! Animation ! Sound

3 Tip Of the Day 4 Tip of the Day: When using graphic methods at Form Load, the AutoRedraw property of the container object must be set to True. (Recall Test#3 - Student mark graph)

4 Circle Method (Revisited) > Me.Circle (x,y), radius

5 Circle Method (Arc) > Me.Circle (x,y), radius,, Start, End angle > Angle measure are in radians

6 Circle Method (Pie Slice) > Me.Circle (x,y), radius,, -Start, -End angle > Start and End angles must be negative

7 PaintPicture Method > The PaintPicture method is used to place an image in a certain location within a container > The syntax is as follows: >object.PaintPicture object2.Picture, x, y

8 Cls Method > The Cls method is used to clear a container of all graphics drawn on it using the graphic methods. > The syntax is as follows: >object.Cls

9 Using a Timer Object > The Timer method is used to execute code at specific time intervals. > A timer object ( ) can be used to simulate animation. > Properties: >Name >Interval >Enabled

10 Timer Object Properties > Properties: >Name >Interval - is the amount of time (milliseconds) before the Timer event is executed. It can be changed at runtime. >Enabled - can be set to either True or False. When enabled is True, the Timer event will be called. When Enabled is False, The Timer event will not be called.

11 Timer Event > The timer event occurs automatically after the amount of time specified in the Interval property. > After the code in the timer event procedure has been executed the timer object start counting down again.

12 Example of Timer Private Sub Timer1_Timer() If Me.BackColor = vbBlue Then Me.BackColor = vbRed Else Me.BackColor = vbBlue End If End Sub

13 Moving Line Program > This program uses the timer event to change the endpoint coordinates of the line randomly after the amount of time specified in the Interval property. > Moving Line Example Moving Line Example

14 Animation > Animation can be simulated by having several images on a form and then activating one image at a time. > For example, to animate a dolphin jumping, 3 pictures have been created at different points during the jump. > A timer object is used to control the speed of the animation.

15 Animation - Dolphin Jump > The 3 pictures can be placed in a control array (Click to see)(Click to see)

16 Animation - Control Array > A control array can be created by setting the Name property to the same value > For example: All 3 dolphin picture objects were named picDolphin and they were given index values 0, 1, 2 >picDolphin(0) >picDolphin(1) >picDolphin(2)

17 Sound - Multimedia Object > A multimedia control can be used to add sound to an application. A multimedia object is created using the MMControl ( ) > To add the Multimedia component if it does not appear in your tool box, follow these steps:

18 Sound - Multimedia Object > Step 1: Choose the Component from the Project menu.

19 Sound - Multimedia Object > Step 2: Click here

20 Sound - Multimedia Object > Properties: >Name >DeviceType - changes the type of device that is playing the sound. We will use.wav files, so the DeviceType is WaveAudio >Enabled - can be set to either True or False. True indicates the object can play sound. >FileName - used to select the file to be played >Visible - establishes whether you can see the object at runtime.

21 Sound - Multimedia Commands > Commands: >Open - opens the mmcObject ready for playing >Close - closes mmcObject. A multimedia object should be closed before ending the application and must be closed before changing the FileName property. >Play - plays the sound track that was opened. >Stop - used to stop the file to being played >Prev - sets the sound track to its beginning.

22 Sound - Multimedia Object > Syntax:mmcObject.Command = Command > Example of opening a multimedia object Private Sub Form_Load() mmcSound.DeviceType = "WaveAudio" mmcSound.FileName = "Laser.wav" mmcSound.Command = "Open" End Sub

23 Sound - Multimedia Object > Syntax:mmcObject.Command = Command > Example of opening a multimedia object Private Sub Form_Unload(Cancel as Integer) mmcSound.Command = "Close" End Sub

24 Disco Dancer 2000 > Check it out! Check it out!

25 Summary > The following concepts were covered today: >Shape >Circles, Arcs and Pie Slices >Picture Box vs. Image Box >PaintPicture >Move Method >Animation >Sound


Download ppt "Multimedia ! Graphics ! Animation ! Sound Tip Of the Day 4 Tip of the Day: When using graphic methods at Form Load, the AutoRedraw property of the container."

Similar presentations


Ads by Google