using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ComponentFactory.Krypton.Toolkit;
using ComponentFactory.Krypton.Ribbon;
using System.Xml;
using System.IO;
using System.Net;
namespace 音乐播放器
{
public partial class MusicPlayer : ComponentFactory.Krypton.Toolkit.KryptonForm
{
public MusicPlayer()
{
InitializeComponent();
}
/// <summary>
/// 打开本地文件
/// </summary>
System.Windows.Forms.OpenFileDialog ofdLightning = new OpenFileDialog();
/// <summary>
/// 播放器
/// </summary>
AxWMPLib.AxWindowsMediaPlayer wmp = new AxWMPLib.AxWindowsMediaPlayer();
/// <summary>
/// 当前播放曲目序号
/// </summary>
private int pos;
/// <summary>
/// 控制快进状态
/// </summary>
private bool ReturnExecute=true;
/// <summary>
/// 播放模式
/// 单曲循环 - Single
/// </summary>
private bool Single=false;
/// <summary>
/// 播放模式
/// 随机播放 - Shuffle
/// </summary>
private bool Shuffle = false;
/// <summary>
/// 播放模式
/// 循序播放 - Step
/// </summary>
private bool Step = false;
/// <summary>
/// 播放模式
/// 循环播放 - Loop
/// </summary>
private bool Loop = false;
//启动状态
//private bool Start = true;
private void kryptonListBox1_SelectedIndexChanged(object sender, EventArgs e)
{
//if (Start == true)
//{
// this.Controls.Add(wmp);
// Start=false;
// return;
//}
this.Controls.Add(wmp);
if (this.kryptonListBox1.Items.Count > 0)
{
if (this.kryptonListBox1.SelectedItems.Count > 0)
{
//wmp.URL = this.kryptonListBox1.SelectedItem.ToString();
//wmp.Ctlcontrols.play();
//this.timer1.Start();
pos = this.kryptonListBox1.SelectedIndex;
wmp.URL = this.kryptonListBox1.Items[pos].ToString();
wmp.Ctlcontrols.play();
this.timer1.Start();
this.kryptonLabel8.Text = this.kryptonListBox1.SelectedItem.ToString();
int ImageInde = ReturnImage();
this.pictureBox10.ImageLocation = Application.StartupPath + "\\" + ImageInde + ".jpg";
}
}
else
{
MessageBox.Show("请选择歌曲!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
private void pictureBox4_MouseEnter(object sender, EventArgs e)
{
this.pictureBox4.BackColor = Color.LightSteelBlue;
}
private void pictureBox4_MouseLeave(object sender, EventArgs e)
{
this.pictureBox4.BackColor = Color.Transparent;
}
private void pictureBox5_MouseEnter(object sender, EventArgs e)
{
this.pictureBox5.BackColor = Color.LightSteelBlue;
}
private void pictureBox2_MouseEnter(object sender, EventArgs e)
{
this.pictureBox2.BackColor = Color.LightSteelBlue;
}
private void pictureBox1_MouseEnter(object sender, EventArgs e)
{
this.pictureBox1.BackColor = Color.LightSteelBlue;
}
private void pictureBox3_MouseEnter(object sender, EventArgs e)
{
this.pictureBox3.BackColor = Color.LightSteelBlue;
}
private void pictureBox6_MouseEnter(object sender, EventArgs e)
{
this.pictureBox6.BackColor = Color.LightSteelBlue;
}
private void pictureBox6_MouseLeave(object sender, EventArgs e)
{
if (Step == true)
{
return;
}
this.pictureBox6.BackColor = Color.Transparent;
}
private void pictureBox3_MouseLeave(object sender, EventArgs e)
{
if (Single == true)
{
return;
}
this.pictureBox3.BackColor = Color.Transparent;
}
private void pictureBox1_MouseLeave(object sender, EventArgs e)
{
if (Shuffle == true)
{