我想实现这个功能,用trackbar控制音乐的进度,同时能通过一个函数接口,显示当前音乐的时间点。具体描述如下:1、鼠标左键按下、并拖动到某一位置时候,一切正常播放;当松开的时候,程序找到音乐当前位置,然后播放。2、当鼠标单击某一位置,那个游标迅速到鼠标所点击的位置,但是在没有松开之前能按正常时间顺序播放,当松开时候立刻找到当前时刻的音乐、并播放。
之所以要显示时间点,我还要用个img显示图片,根据trackbar的进度(就是音乐的时间)显示图片!这个已经没有什么问题了.
关于trackbar没有关于mouse的事件,我找控件代码(comctrl.pas),加两个事件,onmousedown,onmouseup,保存编译这个文件,把生成的dcu文件复制到delphi\lib下面。这样加上了mouse事件,但是我前面的功能却怎么也实现不了,我写下联系方式,和一些代码。
qq 112193644
msn [email protected]
这是trackbar的事件
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;这是timer的
procedure TForm1.T1Timer(Sender: TObject);
begin
if mp.Position>ShowTime then
begin
img.Picture.LoadFromFile(FilePath+Pics[Nex].F);
if Nex<Count-1 then
begin
Nex:=Nex+1;
ShowTime:=Pics[Nex].ShowTime;
end
else ShowTime:=mp.length+1;
end;
if mp.Position>=mp.Length then
begin
if CB1.Checked then
begin
ret.Click;
pla.Click;
end else begin
ret.Click;
end;
end;
if b then TB.Position:=MP.Position;
Pos1.Caption:=inttostr(mp.Position);
np.Caption:=inttostr(showTime);
nx.Caption:=inttostr(Nex);
end;这是trackbar的
procedure TForm1.TBMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
MP.Pause;
T1.Enabled:=false;
Pla.Caption:='Play';
MP.Position:=TB.Position;
Nex:=0;
Showtime:=Pics[Nex].ShowTime;
while ShowTime<mp.Position do
begin
if Nex<Count-1 then
begin
Nex:=Nex+1;
ShowTime:=Pics[Nex].ShowTime;
end
else ShowTime:=mp.length+1;
end;
img.Picture.LoadFromFile(FilePath+Pics[Nex].F);
MP.Play;
T1.Enabled:=true;
b:=true;
end;
各位高手一定帮帮小弟啊,在线等!!!!!
之所以要显示时间点,我还要用个img显示图片,根据trackbar的进度(就是音乐的时间)显示图片!这个已经没有什么问题了.
关于trackbar没有关于mouse的事件,我找控件代码(comctrl.pas),加两个事件,onmousedown,onmouseup,保存编译这个文件,把生成的dcu文件复制到delphi\lib下面。这样加上了mouse事件,但是我前面的功能却怎么也实现不了,我写下联系方式,和一些代码。
qq 112193644
msn [email protected]
这是trackbar的事件
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;这是timer的
procedure TForm1.T1Timer(Sender: TObject);
begin
if mp.Position>ShowTime then
begin
img.Picture.LoadFromFile(FilePath+Pics[Nex].F);
if Nex<Count-1 then
begin
Nex:=Nex+1;
ShowTime:=Pics[Nex].ShowTime;
end
else ShowTime:=mp.length+1;
end;
if mp.Position>=mp.Length then
begin
if CB1.Checked then
begin
ret.Click;
pla.Click;
end else begin
ret.Click;
end;
end;
if b then TB.Position:=MP.Position;
Pos1.Caption:=inttostr(mp.Position);
np.Caption:=inttostr(showTime);
nx.Caption:=inttostr(Nex);
end;这是trackbar的
procedure TForm1.TBMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
MP.Pause;
T1.Enabled:=false;
Pla.Caption:='Play';
MP.Position:=TB.Position;
Nex:=0;
Showtime:=Pics[Nex].ShowTime;
while ShowTime<mp.Position do
begin
if Nex<Count-1 then
begin
Nex:=Nex+1;
ShowTime:=Pics[Nex].ShowTime;
end
else ShowTime:=mp.length+1;
end;
img.Picture.LoadFromFile(FilePath+Pics[Nex].F);
MP.Play;
T1.Enabled:=true;
b:=true;
end;
各位高手一定帮帮小弟啊,在线等!!!!!
用2个Panel模拟,效果都很好的,还可以改变Skin效果呢
[email protected]
[email protected]
[email protected]