1、AxWindowsMediaPlayer的详细用法AxWindowsMediaPlayer的详细用法属性/方法名: 说明:基本属性 URL:String; 指定媒体位置,本机或网络地址uiMode:String; 播放器界面模式,可为Full, Mini, None, InvisibleplayState:integer; 播放状态,1=停止,2=暂停,3=播放,6=正在缓冲,9=正在连接,10=准备就绪enableContextMenu:Boolean; 启用/禁用右键菜单fullScreen:boolean; 是否全屏显示controls wmp.controls /播放器基本控制cont
2、rols.play; 播放controls.pause; 暂停controls.stop; 停止controls.currentPosition:double; 当前进度controls.currentPositionString:string; 当前进度,字符串格式。如“00:23”controls.fastForward; 快进controls.fastReverse; 快退controls.next; 下一曲controls.previous; 上一曲settings wmp.settings /播放器基本设置settings.volume:integer; 音量,0-100settin
3、gs.autoStart:Boolean; 是否自动播放settings.mute:Boolean; 是否静音settings.playCount:integer; 播放次数currentMedia wmp.currentMedia /当前媒体属性currentMedia.duration:double; 媒体总长度currentMedia.durationString:string; 媒体总长度,字符串格式。如“03:24”currentMedia.getItemInfo(const string); 获取当前媒体信息Title=媒体标题,Author=艺术家,Copyright=版权信息,
4、Description=媒体内容描述,Duration=持续时间(秒),FileSize=文件大小,FileType=文件类型,sourceURL=原始地址currentMedia.setItemInfo(const string); 通过属性名设置媒体信息currentMedia.name:string; 同 currentMedia.getItemInfo(Title)currentPlaylist wmp.currentPlaylist /当前播放列表属性currentPlaylist.count:integer; 当前播放列表所包含媒体数currentPlaylist.Iteminte
5、ger; 获取或设置指定项目媒体信息,其子属性同wmp.currentMediaAxWindowsMediaPlayer控件的属MediaPlayer1.Play播放MediaPlayer1.Stop停止MediaPlayer1.Pause暂停MediaPlayer1.PlayCount文件播放次数MediaPlayer1.AutoRewind是否循环播放MediaPlayer1.Balance声道MediaPlayer1.Volume音量MediaPlayer1.Mute静音MediaPlayer1.EnableContextMenu是否允许在控件上点击鼠标右键时弹出快捷菜单MediaPla
6、yer1.AnimationAtStart是否在播放前先播放动画MediaPlayer1.ShowControls是否显示控件工具栏MediaPlayer1.ShowAudioControls是否显示声音控制按钮MediaPlayer1.ShowDisplay是否显示数据文件的相关信息MediaPlayer1.ShowGotoBar是否显示Goto栏MediaPlayer1.ShowPositionControls是否显示位置调节按钮MediaPlayer1.ShowStatusBar是否显示状态栏MediaPlayer1.ShowTracker是否显示进度条MediaPlayer1.Fast
7、Forward快进MediaPlayer1.FastReverse快退MediaPlayer1.Rate快进快退速率MediaPlayer1.AllowChangeDisplaySize是否允许自由设置播放图象大小MediaPlayer1.DisplaySize设置播放图象大小1-MpDefaultSize原始大小2-MpHalfSize原始大小的一半3-MpDoubleSize原始大小的两倍4-MpFullScreen全屏5-MpOneSixteenthScreen屏幕大小的1/166-MpOneFourthScreen屏幕大小的1/47-MpOneHalfScreen屏幕大小的1/2Med
8、iaPlayer1.ClickToPlay是否允许单击播放窗口启动MediaPlayerAxWindowsMediaPlayer常用属性2008-03-18 21:282. Ctlcontrols属性Ctlcontrols属性是AxWindowsMediaPlayer的一个重要属性, 此控件中有许多常用成员。(1) 方法play用于播放多媒体文件,其格式为:窗体名.控件名.Ctlcontrols.play()如: AxWindowsMediaPlayer1.Ctlcontrols.play()此处缺省窗体名是Me(2) 方法pause用于暂停正在播放的多媒体文件,其格式为:窗体名.控件名.Ct
9、lcontrols.pause()如: AxWindowsMediaPlayer1.Ctlcontrols.pause()(3) 方法stop用于停止正在播放的多媒体文件,其格式为:窗体名.控件名.Ctlcontrols.stop()如: AxWindowsMediaPlayer1.Ctlcontrols.stop()(4) 方法fastforward用于将正在播放的多媒体文件快进,其格式为:窗体名.控件名.Ctlcontrols.fastforward()如:AxWindowsMediaPlayer1.Ctlcontrols.forward()(5) 方法fastreverse窗体名.控件名
10、.Ctlcontrols.fastreverse()如:AxWindowsMediaPlayer1.Ctlcontrols.fastreverse()6. 属性CurrentPosition用于获取多媒体文件当前的播放进度,其值是数值类型,使用格式为:窗体名.控件名.Ctlcontrols.currentPositiond1=AxWindowsMediaPlayer1.Ctlcontrols.currentPosition其中d1 是一个整型变量。7. 属性Duration用于获取当前多媒体文件的播放的总时间,其值为数值类型,其使用格式为:窗体名.控件名.currentMedia.durati
11、on如:d2=AxWindowsMediaPlayer1.currentMedia.duration其中d2是一个整型变量。controls.currentPositionString:string; 当前进度,字符串格式。如“00:23”属性/方法名: 说明:基本属性 URL:String; 指定媒体位置,本机或网络地址uiMode:String; 播放器界面模式,可为Full, Mini,None, InvisibleplayState:integer; 播放状态,1=停止,2=暂停,3=播放,6=正在缓冲,9=正在连接,10=准备就绪player.PlayStateChange += n
12、ew AxWMPLib._WMPOCXEvents_PlayStateChangeEventHandler(player_PlayStateChange);private void player_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e) / Test the current state of the player and display a message for each state. switch (e.newState) case 0: / Undefined current
13、StateLabel.Text = Undefined; break; case 1: / Stopped currentStateLabel.Text = Stopped; break; case 2: / Paused currentStateLabel.Text = Paused; break; case 3: / Playing currentStateLabel.Text = Playing; break; case 4: / ScanForward currentStateLabel.Text = ScanForward; break; case 5: / ScanReverse
14、currentStateLabel.Text = ScanReverse; break; case 6: / Buffering currentStateLabel.Text = Buffering; break; case 7: / Waiting currentStateLabel.Text = Waiting; break; case 8: / MediaEnded currentStateLabel.Text = MediaEnded; break; case 9: / Transitioning currentStateLabel.Text = Transitioning; brea
15、k; case 10: / Ready currentStateLabel.Text = Ready; break; case 11: / Reconnecting currentStateLabel.Text = Reconnecting; break; case 12: / Last currentStateLabel.Text = Last; break; default: currentStateLabel.Text = (Unknown State: + e.newState.ToString(); break; enableContextMenu:Boolean; 启用/禁用右键菜
16、单fullScreen:boolean; 是否全屏显示controls.currentPosition:double; 当前进度controls.fastForward; 快进controls.fastReverse; 快退controls.next; 下一曲controls.previous; 上一曲settings wmp.settings /播放器基本设置settings.volume:integer; 音量,0-100settings.autoStart:Boolean; 是否自动播放settings.mute:Boolean; 是否静音settings.playCount:integ
17、er; 播放次数currentMedia wmp.currentMedia /当前媒体属性currentMedia.duration:double; 媒体总长度currentMedia.durationString:string; 媒体总长度,字符串格式。如“03:24”currentMedia.getItemInfo(const string); 获取当前媒体信息Title=媒体标题,Author=艺术家,Copyright=版权信息,Description=媒体内容描述,Duration=持续时间(秒),FileSize=文件大小,FileType=文件类型,sourceURL=原始地址c
18、urrentMedia.setItemInfo(const string); 通过属性名设置媒体信息currentMedia.name:string; 同currentMedia.getItemInfo(Title)currentPlaylist wmp.currentPlaylist /当前播放列表属性currentPlaylist.count:integer; 当前播放列表所包含媒体数currentPlaylist.Iteminteger; 获取或设置指定项目媒体信息,其子属性同wmp.currentMediaaxWindowsMediaPlayer1控件怎么用?就像QQ一样,有消息来就有
19、声音提示。我用axWindowsMediaPlayer1来做声音播放器。但是我不知道axWindowsMediaPlayer1控件怎么用。哪位大侠能给个例子。axWindowsMediaPlayer1控件怎么用?答:没人理我答:用法教程答:msdn参考答:MSDN有WMP的SDK,另外,如果只是一小段声音的话,sndPlaySound函数是个不错的选择(.netframework2.0里在Microsoft.VisualBasic.Devices.Audio类里已经有相关的函数的.net版了,连声明API都省了)答:AxWindowsMediaPlayer Object (VB and C#)
20、The AxWindowsMediaPlayer object is the root object for the Windows Media Player control. It supports the properties, methods, and events listed in the following tables.The AxWindowsMediaPlayer object supports the following properties.PropertyDescriptioncdromCollectionGets an IWMPCdromCollection inte
21、rface.closedCaptionGets an IWMPClosedCaption interface.CtlcontrolsGets an IWMPControls interface.CtlenabledGets or sets a value indicating whether the Windows Media Player control is enabled.currentMediaGets or sets the IWMPMedia interface that corresponds to the current media item.currentPlaylistGe
22、ts or sets the current IWMPPlaylistinterface.dvdGets an IWMPDVD interface.enableContextMenuGets or sets a value indicating whether to enable the context menu, which appears when the right mouse button is clicked.ErrorGets an IWMPError interface.fullScreenGets or sets a value indicating whether video
23、 content is played back in full-screen mode.isOnlineGets a value indicating whether the user is connected to a network.isRemoteNot supported for .NET programming.mediaCollectionGets an IWMPMediaCollection workGets an IWMPNetwork interface.openStateGets a value indicating the state of the content sou
24、rce.playerApplicationNot supported for .NET programming.playlistCollectionGets an IWMPPlaylistCollection interface.playStateGets a value indicating the state of the Windows Media Player operation.settingsGets an IWMPSettings interface.statusGets a value indicating the current status of Windows Media
25、 Player.stretchToFitGets or sets a value indicating whether video will stretch to fit size of the Windows Media Player control video display.uiModeGets or sets a value indicating which controls are shown in the user interface when Windows Media Player is embedded in a Web page.URLGets or sets the na
26、me of the clip to play.versionInfoGets a value that specifies the version of the Windows Media Player.windowlessVideoGets or sets a value indicating whether the Windows Media Player control renders video in windowless mode.MethodDescriptioncloseReleases Windows Media Player resources.launchURLSends
27、a URL to the users default browser to be rendered.newMediaReturns an IWMPMedia interface for a new media item.newPlaylistreturns an IWMPPlaylist interface for a new playlist.openPlayerOpens Windows Media Player using the specified URL.The AxWindowsMediaPlayer object supports the following events.EventDescriptionAudioLanguageChangeOccurs when the current audio
copyright@ 2008-2023 冰点文库 网站版权所有
经营许可证编号:鄂ICP备19020893号-2