sintak

//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
Image1->Picture->LoadFromFile("Image0463.bmp");
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
ProgressBar1->Position=
MediaPlayer1->Position*100/MediaPlayer1->Length;
if (ProgressBar1->Position==100)
Timer1->Enabled=false;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::MediaPlayer1Click(TObject *Sender,
      TMPBtnType Button, bool &DoDefault)
{
switch (Button) {
case btPlay : Timer1->Enabled=true; break;
case btStop : ProgressBar1->Position=0; Timer1->Enabled=false; break;
}
}
//---------------------------------------------------------------------------

void __fastcall TForm1::FileListBox1Change(TObject *Sender)
{
if (FileListBox1->FileName !=NULL) {
MediaPlayer1->FileName = FileListBox1->FileName;
try
{
MediaPlayer1->Enabled=true;
MediaPlayer1->Open();
}
catch (...)
{
MediaPlayer1->Enabled=false;
}
}
}
//---------------------------------------------------------------------------

0 komentar:

Poskan Komentar