RAD Studio
ContentsIndex
PreviousUpNext
Example of Adding Silent Video Clips

Suppose you want to display an animated logo as the first screen that appears when your application starts. After the logo finishes playing the screen disappears.

To run this example, create a new project and save the Unit1.pas file as Frmlogo.pas and save the Project1.dpr file as Logo.dpr. Then:

  1. Double-click the animate icon from the Win32 category of the Tool palette.
  2. Using the Object Inspector, set its Name property to Logo1.
  3. Select its FileName property, click the ellipsis (...) button, locate and choose an AVI file. Then click Open in the Open AVI dialog. This loads the AVI file into memory.
  4. Position the animation control box on the form by clicking and dragging it to the top right hand side of the form.
  5. Set its Repetitions property to 5.
  6. Click the form to bring focus to it and set its Name property to LogoForm1 and its Caption property to Logo Window. Now decrease the height of the form to right-center the animation control on it.
  7. Double-click the form's OnActivate event and write the following code to run the AVI clip when the form is in focus at runtime:

Logo1.Active := True;

 

Logo1->Active = true;

  1. Double-click the Label icon on the Standard category of the Tool palette. Select its Caption property and enter Welcome to Cool Images 4.0. Now select its Font property, click the ellipsis (...) button and choose Font Style: Bold, Size: 18, Color: Navy from the Font dialog and click OK. Click and drag the label control to center it on the form.
  2. Click the animation control to bring focus back to it. Double-click its OnStop event and write the following code to close the form when the AVI file stops:

LogoForm1.Close;

 

LogoForm1->Close();

Select RunRun to execute the animated logo window.

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!