简单问题(播放器!!!!)马上送分(100分)

  • 主题发起人 主题发起人 superqq
  • 开始时间 开始时间
S

superqq

Unregistered / Unconfirmed
GUEST, unregistred user!
用delphi5的媒体播放器怎么才能实现全屏播放,还有调整播放窗体的大小和得到播放
的时间,谢谢!
 
Form1.BorderStyle:=bsNone;
Form1.WindowState:=wsMaxinized;
Form1.Height:=Screen.Height;
Form1.Width:=Screen.Width;
Form1.Left:=0;
Form1.Top:=0;
MediaPlayer1.Open;
MediaPlayer1.Display:=Form1;
MediaPlayer1.DisplayRect:=Form1.ClientRect;
全屏播放的思路,供你参考
 
还有得到播放时间呢?要实现鼠标拖动改变播放的进度呢?这两个问题一解决就送分.
 
mediaplayer1.position控制播放位置

设置mediaplayer1.positon:=trackbar.position就可以实现鼠标拖动效果了
trackbar.max:=mediaplayer1.length
 
ps:mediaplayer1.position返回的是毫秒为单位的整数,需要自己换算成HH:MM:SS的格式
 
Enigma:
你说的方法根本不行
我播放一个MPG文件,它绐终只在那一小块放映.
 
[blue]可是可以,我知道了一个更好的方法.但得到播放时间还没搞定啊.[/blue]
 
superqq:
什么更好的方法?是关于改变播放窗口大小的方法?
我正为此事发愁呢...
能说出来听听吗?
 
谁快告诉我播放时间怎么换算啊,就差这一个了,说了就送分。
 
The following code declares a HMSRec record with four byte fields. If TimeFormat is tfHMS, the first field specifies hours, the second field specifies minutes, the third field specifies seconds, and the fourth field corresponds to the unused most-significant byte of the tfHMS time format. A LongInt variable is typecast to an HMSRec record, then
the hours, minutes, and seconds of the Length of the loaded media are displayed in labels when the user clicks a button.

type

HMSRec = record
Hours: byte;
Minutes: byte;
Seconds: byte;
NotUsed: byte;

end;


procedure TForm1.Button1Click(Sender: TObject);

var
TheLength: LongInt;
begin


{ Set time format - note that some devicesdo
n抰 support tfHMS }

MediaPlayer1.TimeFormat := tfHMS;
{ Store length of currently loaded media }
TheLength := MediaPlayer1.Length;
with HMSRec(TheLength)do
{ Typecast TheLength as a HMSRec record }
begin

Label1.Caption := IntToStr(Hours);
{ Display Hours in Label1 }
Label2.Caption := IntToStr(Minutes);
{ Display Minutes in Label2 }
Label3.Caption := IntToStr(Seconds);
{ Display Seconds in Label3 }
end;

end;
 
离线光盘搜,讨论过N次的了
同意楼上的
 
TO superqq
我知道如何控制时间和进度
但是你能否告诉我如何改变播放区域大小??
 
align:=alclient;
 
to it_boy69
mediaplay1.displayrect=rect(0,0,a,b)
(a,b是大小)
 
to 影子
这不就是英文帮助上面的吗,我在这之前已经试过了,不行啊,
 
不行的。。窗口全屏幕后,就没有视频了。。
用timer控制trackbar控件显示播放的进度时就不能用trackbar的onchange事件控制媒
体的播放位置了,要怎么样才能让trackbar既能反映媒体的播放进度,又能通过托动它来
改变媒体的播放位置呢??
 
to jsxjd:
你说的align是那一个控件的属性?
 
Form1.BorderStyle:=bsNone;
Form1.WindowState:=wsMaxinized;
Form1.Height:=Screen.Height;
Form1.Width:=Screen.Width;
Form1.Left:=0;
Form1.Top:=0;
MediaPlayer1.Open;
panel1.align:=alclient;
MediaPlayer1.Display:=panel1;
MediaPlayer1.DisplayRect:=panel1.ClientRect;

时间进度播放我用progressbar

也可以控制全屏然后恢复视窗的
 
后退
顶部