Информатика. Программирование в Delphi
327
ProgressBar1.Position:=0;
ProgressBar1.Step:=1;
ProgressBar1.Smooth:=true;
GetHMS(MediaPlayer1.Length,h,m,s);
rw:=MediaPlayer1.DisplayRect.Right;
rh:=MediaPlayer1.DisplayRect.Bottom;
if rw>rh then
begin
dw:=Panel1.Width-6;
dh:=round(dw*rh/rw); l:=3;
t:=(Panel1.Height div 2) - (dh div 2);
end
else
begin
dh:=Panel1.Height-6; dw:=round(dh*rh/rw);
l:=(Panel1.Width div 2) - (dw div 2); t:=3;
end;
MediaPlayer1.DisplayRect:=Rect(l,t,dw,dh);
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var
pr:byte;
hh,mm,ss:byte;
begin
ProgressBar1.Position:=MediaPlayer1.Position;
pr:=round(ProgressBar1.Position*100 / ProgressBar1.Max);
Label1.Caption:=IntToStr(pr)+'%';
GetHMS(MediaPlayer1.Position,hh,mm,ss);
Label2.Caption:=GetHHMMSS(hh,mm,ss)+#32+'\'+#32+
GetHHMMSS(h,m,s);
end;
procedure TForm1.ProgressBar1MouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
pr:byte;
hh,mm,ss:byte;
begin
if MediaPlayer1.FileName<>'' then
begin
ProgressBar1.Position:=round(ProgressBar1.Max*X /
ProgressBar1.Width);
MediaPlayer1.Position:=ProgressBar1.Position;
I...,317,318,319,320,321,322,323,324,325,326 328,329,330,331,332,333,334,335,336,337,...370