Цитата:
все бы ничего но но в трек баре TrackBar2MouseDown такого нет
|
извиняюсь, на память писал.
Цитата:
Тупо убери poschange и все будет работать
|
у него так и было
можно заменить трекбар на пэйнтбокс:
Код:
procedure TForm1.Timer1Timer(Sender: TObject);
var r:single;
begin
if MediaPlayer1.Enabled then
begin
with PaintBox3.Canvas do
begin
Pen.Style:=psSolid;
Brush.Color:=clBtnFace;
Rectangle(0, 0, PaintBox3.Width, PaintBox3.Height);
Pen.Style:=psClear;
r:=MediaPlayer1.Length
if r>0 then
r:=MediaPlayer1.Position/r;
Brush.Color:=clRed;
Rectangle(1, 1, Round(PaintBox3.Width*r), PaintBox3.Height);
end;
end;
end;
procedure TForm1.PaintBox3MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if Button=mbLeft then
begin
poschanging:=true;
MediaPlayer1.Position := Round(X*MediaPlayer1.Length/PaintBox3.Width);
end;
end;
procedure TForm1.PaintBox3MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if poschanging then
MediaPlayer1.Position := Round(X*MediaPlayer1.Length/PaintBox3.Width);
end;
procedure TForm1.PaintBox3MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
poschanging:=false;
end;