This example shows how to show an AVI animated file without sound while the program is running.
Add a tanimate component to the form and set its Commonavi property to Avicopyfile so that the animation of the copied file is displayed in the Tanimate component. The form after you add the component is shown in Figure 1.
Figure 1 form after adding a component |
Add the following code during the initialization of the form:
Procedure Tform1.formcreate (Sender:tobject); Begin Self. Animate1.active:=true; End |
In this way, the program activates the Tanimate component at the beginning of the program's operation, thus starting to play the animated avicopyfile of the copied file.
The program code is as follows:
Unit Unit1; Interface Uses
Windows, Messages, sysutils, variants, Classes, Graphics, Controls, Forms,
Dialogs, Comctrls;
Type TForm1 = Class (Tform) Animate1:tanimate; Procedure Formcreate (Sender:tobject); Private {Private declarations} Public {Public declarations} End
Var Form1:tform1; Implementation {$R *.DFM} Procedure Tform1.formcreate (Sender:tobject); Begin Self. Animate1.active:=true; End
End. |
Save the file, and then press F9 to run the program, and the results of the program run as shown in Figure 2.
Figure 2 Program Run results |
The program does not call AVI animation files in the disk, the reader in their own applications can be specified Tanimate component of the FileName property to play a no sound avi animation files.