-
Windows平台C#视频播放器
资源介绍
C#windows实训题, private void Mp3size()
{
//获得文件大小
try
{
FileInfo MyFileInfo = new FileInfo(this.listBoxPlayer.SelectedItem.ToString());
float MyFileSize = (float)MyFileInfo.Length / (1024 * 1024);
this.labeMp3Size.Text = MyFileSize.ToString().Substring(0, 6) + "M";
}
catch
{
this.labeMp3Size.Text = "";
}
}
//保存播放列表
private void savePlayList()
{
Stream mysavefile;
SaveFileDialog saveFileDialog1 = new SaveFileDialog();
saveFileDialog1.Filter = "播放列表文件|*.plt";
saveFileDialog1.InitialDirectory = Application.StartupPath;
saveFileDialog1.Title = "Save an Image File";
//saveFileDialog1.ShowDialog();
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
if ((mysavefile = saveFileDialog1.OpenFile()) != null)
{
// Code to write the stream goes here.
//mysavefile.Write(this.listBox1.Items.ToString());
mysavefile.Close();
//保存播放列表
StreamWriter sw = new StreamWriter(saveFileDialog1.FileName);
this.listBoxPlayer.SelectedIndex = 0;
for (int i = 1; i < this.listBoxPlayer.Items.Count; i++)
{
sw.WriteLine(this.listBoxPlayer.SelectedItem.ToString());
this.listBoxPlayer.SelectedIndex += 1;
}
sw.Close();
}
}
}