标题:头疼,帮帮我吧
只看楼主
yongqing03815
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2005-4-27
 问题点数:0 回复次数:1 
头疼,帮帮我吧
那位高手能否帮我看一下这个程序,哪儿有问题,本人将不胜感激!!,***注意打大括号的可以不看*** Public Class frmvbplayer Inherits System.Windows.Forms.Form ***{#Region " Windows 窗体设计器生成的代码 " Public Sub New() MyBase.New() '该调用是 Windows 窗体设计器所必需的。 InitializeComponent() '在 InitializeComponent() 调用之后添加任何初始化 End Sub '窗体重写 dispose 以清理组件列表。 Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub 'Windows 窗体设计器所必需的 Private components As System.ComponentModel.IContainer '注意: 以下过程是 Windows 窗体设计器所必需的 '可以使用 Windows 窗体设计器修改此过程。 '不要使用代码编辑器修改它。 Friend WithEvents player As AxMicrosoft.MediaPlayer.Interop.AxWindowsMediaPlayer Friend WithEvents lblTitle As System.Windows.Forms.Label Friend WithEvents btnOpen As System.Windows.Forms.Button Friend WithEvents btnPlayPause As System.Windows.Forms.Button Friend WithEvents btnStop As System.Windows.Forms.Button <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmvbplayer)) Me.player = New AxMicrosoft.MediaPlayer.Interop.AxWindowsMediaPlayer Me.lblTitle = New System.Windows.Forms.Label Me.btnOpen = New System.Windows.Forms.Button Me.btnPlayPause = New System.Windows.Forms.Button Me.btnStop = New System.Windows.Forms.Button CType(Me.player, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' 'player ' Me.player.Enabled = True Me.player.Location = New System.Drawing.Point(-8, 0) Me.player.Name = "player" Me.player.OcxState = CType(resources.GetObject("player.OcxState"), System.Windows.Forms.AxHost.State) Me.player.Size = New System.Drawing.Size(304, 176) Me.player.TabIndex = 0 Me.player.TabStop = False ' 'lblTitle ' Me.lblTitle.Location = New System.Drawing.Point(16, 192) Me.lblTitle.Name = "lblTitle" Me.lblTitle.TabIndex = 1 Me.lblTitle.Text = "标题" ' 'btnOpen ' Me.btnOpen.Location = New System.Drawing.Point(208, 192) Me.btnOpen.Name = "btnOpen" Me.btnOpen.TabIndex = 2 Me.btnOpen.Text = "打开" ' 'btnPlayPause ' Me.btnPlayPause.Enabled = False Me.btnPlayPause.Location = New System.Drawing.Point(56, 232) Me.btnPlayPause.Name = "btnPlayPause" Me.btnPlayPause.TabIndex = 3 Me.btnPlayPause.Text = "播放" ' 'btnStop ' Me.btnStop.Enabled = False Me.btnStop.Location = New System.Drawing.Point(160, 232) Me.btnStop.Name = "btnStop" Me.btnStop.TabIndex = 4 Me.btnStop.Text = "停止" ' 'frmvbplayer ' Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14) Me.ClientSize = New System.Drawing.Size(292, 266) Me.Controls.Add(Me.btnStop) Me.Controls.Add(Me.btnPlayPause) Me.Controls.Add(Me.btnOpen) Me.Controls.Add(Me.lblTitle) Me.Controls.Add(Me.player) Me.Name = "frmvbplayer" Me.Text = "vb player" CType(Me.player, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False) End Sub #End Region}*** Private Sub btnOpen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOpen.Click Dim openfiledialog1 As New OpenFileDialog openfiledialog1.Filter = "windows media 音频 (*.wma)|*.wma|windows media视频(*.wmv)|*.wmv" openfiledialog1.RestoreDirectory = True If openfiledialog1.ShowDialog() = DialogResult.OK Then player.URL = openfiledialog1.FileName End If End Sub Private Sub btnPlayPause_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnPlayPause.Click Dim wmpplaystate As New player.playstate Select Case player.playState Case wmpplaystate.wmppsPlaying player.Controls.pause() Case wmpplaystate.wmppspaused player.Controls.play() Case wmpplaystate.wmppsStopped player.Controls.play() End Select End Sub Private Sub btnStop_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnStop.Click player.Controls.stop() End Sub Private Sub player_PlayStateChange(ByVal sender As Object, ByVal e As AxMicrosoft.MediaPlayer.Interop._WMPOCXEvents_PlayStateChangeEvent) Handles player.PlayStateChange Select Case e.newState Case wmpplaystate.wmppsplaying btnPlayPause.Enabled = True btnStop.Enabled = True btnPlayPause.Text = "暂停" lblTitle.Text = "标题:" & player.currentMedia.getItemInfobytype("title", "", 0) Case wmpplaystate.wmppspaused btnPlayPause.Text = "播放" Case wmpplaystate.wmppsstopped btnStop.Enabled = False btnPlayPause.Text = "播放" End Select End Sub End Class位高手能否帮我看一下这个程序,哪儿有问题,本人将不胜感激!!
搜索更多相关主题的帖子: 头疼 
2005-04-27 15:25
网络游侠
Rank: 1
等 级:新手上路
帖 子:52
专家分:0
注 册:2004-9-27
得分:0 

我追求! 我需要! 我感受! 你是我的一切!
2005-04-27 15:51



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-16846-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.071324 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved