using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;namespace 听力练习播放器
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} string filename; string fullpath;
string alltime;
string currenttime;
private void 打开ToolStripMenuItem_Click(object sender, EventArgs e)
{
OpenFileDialog openfile = new OpenFileDialog();
openfile.InitialDirectory = "D:\\歌曲";
openfile.ShowDialog(); filename = openfile.FileName;
fullpath = Path.GetFullPath(filename);
this.axWindowsMediaPlayer1.URL = fullpath;
axWindowsMediaPlayer1.Ctlcontrols.play();
alltime = this.axWindowsMediaPlayer1.currentMedia.durationString; this.time_all.Text = alltime; this.namesong.Text = this.axWindowsMediaPlayer1.currentMedia.name; currenttime = this.axWindowsMediaPlayer1.currentMedia.duration.ToString();
}
private void Form1_Load(object sender, EventArgs e)
{
this.namesong.Text="";
this.time_all.Text = "";
this.time_now.Text=""; } private void menuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
{ }
}
}这个 里我要获取歌曲的总时间,用的是
alltime = this.axWindowsMediaPlayer1.currentMedia.durationString;这个方法怎么没有生效
还有就是
这个控件的一些音量调节按钮和可否去掉,
我想编写当前播放进度的代码,需要TIMER控件吗
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;namespace 听力练习播放器
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} string filename; string fullpath;
string alltime;
string currenttime;
private void 打开ToolStripMenuItem_Click(object sender, EventArgs e)
{
OpenFileDialog openfile = new OpenFileDialog();
openfile.InitialDirectory = "D:\\歌曲";
openfile.ShowDialog(); filename = openfile.FileName;
fullpath = Path.GetFullPath(filename);
this.axWindowsMediaPlayer1.URL = fullpath;
axWindowsMediaPlayer1.Ctlcontrols.play();
alltime = this.axWindowsMediaPlayer1.currentMedia.durationString; this.time_all.Text = alltime; this.namesong.Text = this.axWindowsMediaPlayer1.currentMedia.name; currenttime = this.axWindowsMediaPlayer1.currentMedia.duration.ToString();
}
private void Form1_Load(object sender, EventArgs e)
{
this.namesong.Text="";
this.time_all.Text = "";
this.time_now.Text=""; } private void menuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
{ }
}
}这个 里我要获取歌曲的总时间,用的是
alltime = this.axWindowsMediaPlayer1.currentMedia.durationString;这个方法怎么没有生效
还有就是
这个控件的一些音量调节按钮和可否去掉,
我想编写当前播放进度的代码,需要TIMER控件吗
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货