大雀软件园

首页 软件下载 安卓市场 苹果市场 电脑游戏 安卓游戏 文章资讯 驱动下载
技术开发 网页设计 图形图象 数据库 网络媒体 网络安全 站长CLUB 操作系统 媒体动画 安卓相关
当前位置: 首页 -> 技术开发 -> 程序开发 -> 循环播放音乐

循环播放音乐

时间: 2021-07-31 作者:daque

unit unit1; interface uses windows, messages, sysutils, classes, graphics, controls, forms, dialogs, mplayer, stdctrls; type tform1 = class(tform) mediaplayer1: tmediaplayer; button1: tbutton; opendialog1: topendialog; procedure mediaplayer1notify(sender: tobject); procedure mediaplayer1click(sender: tobject; button: tmpbtntype; var dodefault: boolean); procedure button1click(sender: tobject); private { private declarations } public { public declarations } end; var form1: tform1; implementation {$r *.dfm} procedure tform1.mediaplayer1notify(sender: tobject); begin     with mediaplayer1    do     begin     if notify and //接收消息         (mode=mpstopped) then//仍旧遏止         begin         rewind;     play;     end;     notify:=true;//发端接收消息 end; end; procedure tform1.mediaplayer1click(sender: tobject; button: tmpbtntype; var dodefault: boolean); begin     if (button=btstop) or (button=btpause) then     mediaplayer1.notify:=false else     mediaplayer1.notify:=true;  end; procedure tform1.button1click(sender: tobject); begin     if opendialog1.execute then     with mediaplayer1    do     begin     filename:=opendialog1.filename; notify:=true; try     open;     play; except     raise exception.create('翻开文献时堕落'); end; caption:='轮回播放演练-->'+filename; end; end; end. 窗体as text代码  object form1: tform1 left = 195 top = 107 width = 378 height = 182 caption = '轮回播放演练' color = clbtnface font.charset = default_charset font.color = clwindowtext font.height = -11 font.name = 'ms sans serif' font.style = [] oldcreateorder = false pixelsperinch = 96 textheight = 13 object mediaplayer1: tmediaplayer left = 24 top = 16 width = 298 height = 33 taborder = 0 onclick = mediaplayer1click onnotify = mediaplayer1notify end object button1: tbutton left = 193 top = 104 width = 129 height = 33 caption = '翻开...' default = true taborder = 1 onclick = button1click end object opendialog1: topendialog title = '翻开音乐文献' left = 294 top = 32 end end //////////////////////////////////////////////////// if fileexists(extractfilepath(application.exename)+'runlib\t01.avi') then   begin    mediaplayer1.filename:=(extractfilepath(application.exename)+'runlib\t01.avi');    mediaplayer1.open;    mediaplayer1.notify:=true;    mediaplayer1.display:=form2;    mediaplayer1.displayrect:=form2.clientrect;    mediaplayer1.play;   end; 而后如次让它轮回 procedure tform2.mediaplayer1notify(sender: tobject); begin   if mcistop=1 then exit;   if mediaplayer1.mode=mpstopped then   begin     mediaplayer1.rewind;     mediaplayer1.play;   end;   mediaplayer1.notify:=true; end;

热门阅览

最新排行

Copyright © 2019-2021 大雀软件园(www.daque.cn) All Rights Reserved.