J
javadiy
Unregistered / Unconfirmed
GUEST, unregistred user!
我用mediaplayer做了个简单的媒体播放器,而且是照有关书上例子做的。可是却不能运行。只是闪一下就又回到了编辑状态。请问这是为什么呢?谢谢!
相关代码如下:
procedure TForm1.formclose(Sender: TObject; var Action: TCloseAction);
begin
form1.Mediaplayer1.close;
end;
procedure TForm1.formcreat(Sender: TObject);
begin
form1.MediaPlayer1.open;
form1.opendialog1.filter:='wave Files(*.wav)|*.wav'+'all files(*.*)|*.*';
end;
procedure TForm1.button1click(Sender: TObject);
begin
form1.OpenDialog1.execute;
end;
procedure TForm1.opendialogcanclose(Sender: TObject;
var CanClose: Boolean);
begin
if form1.opendialog1.fileName<>''
then
form1.Mediaplayer1.fileName:=form1.opendialog1.filename;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
form1.TrackBar1.Min:=0;
form1.TrackBar1.max:=form1.Mediaplayer1.length;
form1.TrackBar1.position:=form1.mediaplayer1.position;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
form1.opendialog1.filter:='all files(*.*)|*.*';
form1.opendialog1.filter:=form1.opendialog1.filter+'wave files(*.wave)|*.wave';
end;
end.
相关代码如下:
procedure TForm1.formclose(Sender: TObject; var Action: TCloseAction);
begin
form1.Mediaplayer1.close;
end;
procedure TForm1.formcreat(Sender: TObject);
begin
form1.MediaPlayer1.open;
form1.opendialog1.filter:='wave Files(*.wav)|*.wav'+'all files(*.*)|*.*';
end;
procedure TForm1.button1click(Sender: TObject);
begin
form1.OpenDialog1.execute;
end;
procedure TForm1.opendialogcanclose(Sender: TObject;
var CanClose: Boolean);
begin
if form1.opendialog1.fileName<>''
then
form1.Mediaplayer1.fileName:=form1.opendialog1.filename;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
form1.TrackBar1.Min:=0;
form1.TrackBar1.max:=form1.Mediaplayer1.length;
form1.TrackBar1.position:=form1.mediaplayer1.position;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
form1.opendialog1.filter:='all files(*.*)|*.*';
form1.opendialog1.filter:=form1.opendialog1.filter+'wave files(*.wave)|*.wave';
end;
end.