var
i:byte;
......
//ListBox1的mulselected设置为true;
procedure TForm1.FormCreate(Sender: TObject);
begin
i := 1;
ListBox1.Selected[0] := true;
mediaplayer1.play;
end;
procedure TForm1.MediaPlayer1Notify(Sender: TObject);
begin
ListBox1.Selected := true;
mediaplayer1.filename := ListBox1.Items;
mediaplayer1.open;
mediaplayer1.play;
i := i + 1;
if i > ListBox1.Items.count - 1 then
i := 0;
end;
或
procedure TForm1.Timer1Timer(Sender: TObject);
begin
Label1.caption := timetostr(time);
if mediaplayer1.position=mediaplayer1.TrackLength[1] then
begin
ListBox1.Selected:=true;
mediaplayer1.filename:=ListBox1.Items;
mediaplayer1.open;
mediaplayer1.play;
i:=i+1;
if i>ListBox1.Items.count - 1 then
i:=0;
end;
end;