delphi 把MP3做背景音乐

2018-10-30

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, MPlayer;

type
TForm1 = class(TForm)
Button1: TButton;
MediaPlayer1: TMediaPlayer;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
MediaPlayer1.Visible := False;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
MediaPlayer1.FileName := 'c:\temp\Test.mp3';
MediaPlayer1.Open;
MediaPlayer1.Play;
end;

end.
阅读19