一个项目,一分收获;一个项目,一些资源。Ktv项目也是一样的,所以我想分享我的收获,让你们获得你需要的资源。

     一. 那MyKTV点歌系统具体的功能有哪些呢?我们就来看看吧!

    1.MyKTV前台功能:

     01.歌星点歌 、拼音点歌 、数字点歌 、类型选择 、金榜排行

     02.切歌 、点歌 、重唱和退出

 

     2.MyKTV后台功能:

      01.歌手管理 、歌曲管理 、设置资源路径

      02.新增歌手、歌曲 ,查询歌手、歌曲信息,设置歌曲路径和退出

 

      二. 功能已经概括的差不多了,就让我们一起来看看MyKTV的项目吧

  四个辅助类

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyKTV
{
    class KTVUtil
    {
        public static string picturePath = "";
        public static string songPath = "";
    }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyKTV
{
   class PlayList
    {
      
        public  static Song[] SongList=new Song[1000];
       //当前播放的歌曲在数组中的索引(已点列表)
        public static int SongIndex = 0;

       //点一首歌,相当于将歌曲放在数组中
        public  static bool AddSong(Song song)
        {
            bool result = false;//记录添加歌曲是否成功
            for (int i = 0; i < SongList.Length; i++)
            {
                if (SongList [i]==null)
                {
                    SongList[i] = song;
                    result = true;
                    break;
                }
            }
            return result;
        }
        //获取当前播放的歌曲  既然是获取当前播放的歌曲,返回值肯定是Song类型
       public  static Song GetPlaySong()
        {
            if (SongList [SongIndex]!=null)
            {
                return SongList[SongIndex];
            }
            else
            {
                return null;
            }
        }
       //播放下一首
        public static void Next()
        {
            if (SongList[SongIndex] != null && SongList[SongIndex].PlayStar== SongPlayState.again)
            {
                SongList[SongIndex].SongPlayed();
            }
            else
            {
                SongIndex++;
                if (SongList[SongIndex]!=null)
                {
                     SongList[SongIndex].SongPlayed();
                }
               
            }
        }
       //当前播放的歌曲名称
        public static string PlaySongName()
        {
            string songname = "";
            if (SongList[SongIndex]!=null)
            {
                songname=SongList[SongIndex].SongName;
            }
            return songname;
        }
       //下一首要播放的歌曲名称
        public static string NextSongName()
        {
            string songname = "";
            //if (SongList[SongIndex+1] != null&&SongList[0]!=null)
            //{
            //    songname = SongList[SongIndex+1].SongName;

            //}
            //return songname;

            if (SongList[0] != null && SongList[SongIndex + 1] == null)
            {
                songname = "待添加....";
                return songname;
            }
            else
            {
                if (SongList[0] != null)
                {
                    songname = SongList[SongIndex + 1].SongName;
                    return songname;
                }
                else
                {
                    return string.Empty;
                }

            }
        }
       //重唱
        public static void PalyAgain()
        {
            if (SongList[SongIndex]!=null)
            {
                SongList[SongIndex].SongAgain();

            }
        }
       
       //切歌
        public static void Cutsong()
        {
            //获取到当前播放的歌曲改变播放状态
            if (SongList [SongIndex] != null)
            {
                SongList [SongIndex].PlayStar = SongPlayState.cut;
                SongIndex++;   //改变歌曲索引,播放下一首
            }
            

        }
       ////切歌
       // public static void CutSong(int index)
       // {
       //     //迭代变量,代表切歌位置
       //     int i;
       //     if (index==-1)//循环变量,代表切歌位置
       //     {
       //         i=SongIndex;
       //     }else
       //     {
       //         //从切歌的位置开始,将歌曲逐个向前移动一个位置
       //         i=index;
       //     }
       //     SongList[i].SongCut();
       //     while (SongList[i]!=null)
       //     {
       //         SongList[i]=SongList[i+1];
       //         i++;
              
       //     }
           
       // }
    }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyKTV
{
 enum SongPlayState
    {
        //未播放,播放,重播,切歌
        unplayer, played, again, cut
    }
  public class Song
    {
      
        private string songName;

        public string SongName
        {
            get { return songName; }
            set { songName = value; }
        }
        private string songUrl;

        public string SongUrl
        {
            get { return songUrl; }
            set { songUrl = value; }
        }
        //歌曲播放状态默认为未播放
        private SongPlayState playStar = SongPlayState.unplayer;

      internal SongPlayState PlayStar
        {
            get { return playStar; }
            set { playStar = value; }
        }

       

        //将歌曲状态改为播放
        public void SongPlayed()
        {

            this.PlayStar = SongPlayState.played;
        }
        //歌曲状态重播
        public void SongAgain()
        {
            this.PlayStar = SongPlayState.again;
        }
        //歌曲状态切歌
        public void SongCut()
        {
            this.PlayStar = SongPlayState.cut;
        }
    }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyKTV
{
    class SqlUtil
    {
        public static string str = "data source=.;initial catalog=KTV;user id=sa;pwd=718191";
    }
}

 

        1.首先就是展现KTV的主界面,让我们先了解一下那些功能

     

ktv管理系统java ktv管理系统主要功能_Click

         01.实现各个共功能的主代码:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace MyKTV
{
    public partial class frmMain : Form
    {
        public frmMain()
        {
            //InitializeComponent();
        }

        private void btnGX_Click(object sender, EventArgs e)
        {
            frmGXDG1 fg = new frmGXDG1();
            fg.form1 = this;
            fg.Show();
            this.Hide();
        }
        //获取歌曲路径
        public void SongPath()
        {
            string sql = "select resourcepath from resourcepath where resourceid=1";
            SqlConnection con = new SqlConnection(SqlUtil.str);
            SqlCommand com = new SqlCommand(sql, con);
            try
            {
                con.Open();
                KTVUtil.songPath= com.ExecuteScalar().ToString();
            }
            catch (Exception)
            {

                throw;
            }
            finally
            {
                con.Close();
            }
        }
        private void frmMain_Load(object sender, EventArgs e)
        {
            
            //读取歌曲路径
            SongPath();
            //读取resourcepath表中的歌手图片
            string sql = "select resourcepath from resourcepath where resourceid=2";
            SqlConnection con = new SqlConnection(SqlUtil.str);
            SqlCommand com = new SqlCommand(sql,con);
            try
            {
                con.Open();
                KTVUtil.picturePath=com.ExecuteScalar().ToString();
            }
            catch (Exception)
            {

                throw;
            }
            finally
            {
                con.Close();
            }
        }
        private Song song;//当前播放的歌曲
        //播放歌曲
        public void PlaySong()
        {
            //调用播放当前歌曲方法
            this.song = PlayList.GetPlaySong();
            if (song!=null)
            {
                //改变播放状态为播放
                this.song.SongPlayed();
                Player2.URL = KTVUtil.songPath + "\\" + this.song.SongUrl;
               
                txtIng.Text = PlayList.PlaySongName();
                
            }
        }

        private void btnPY_Click(object sender, EventArgs e)
        {
            frmPY fp = new frmPY();
            fp.Show();
        }

        private void btnSZ_Click(object sender, EventArgs e)
        {
            frmNum fn = new frmNum();
            fn.Show();
        }

        private void btnLX_Click(object sender, EventArgs e)
        {
            frmType ft = new frmType();
            ft.getSong(song);
            
            ft.Show();
        }

        private void btnJB_Click(object sender, EventArgs e)
        {
            frmPaiHang fp = new frmPaiHang();
            fp.Show();
        }
         
        private void toolStripButton3_Click(object sender, EventArgs e)
        {

                frmYiDian fy = frmYiDian.getFrm();
                fy.Show();
            
            
        }

        private void panel2_Paint(object sender, PaintEventArgs e)
        {

        }
       public static int cutSong = 0;
       private void timer1_Tick(object sender, EventArgs e)
       {
           String nextSongName = PlayList.NextSongName();
           txtNext.Text = nextSongName;
           if (song == null)
           {
               PlaySong();
           }
           if (Player2.playState == WMPLib.WMPPlayState.wmppsStopped)
           {
               song = null;
               PlayList.Next();
           }
           if (song != null && this.song.PlayStar == SongPlayState.cut)
           {
               this.song = null;
           }
           if (song != null)
           {
               if (this.song.PlayStar == SongPlayState.again)
               {
                   this.song = null;
               }
           }
       }
        private void toolStripButton5_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void Player2_Enter(object sender, EventArgs e)
        {

        }

        private void timNow_Tick(object sender, EventArgs e)
        {
           
           
        }

        private void toolStripButton2_Click(object sender, EventArgs e)
        {

            DialogResult result = MessageBox.Show("确定要切歌吗?", "", MessageBoxButtons.YesNo);
            if (result==DialogResult.Yes)
            {
                PlayList.Cutsong();
 
            }
           
        }

        private void toolStripButton1_Click(object sender, EventArgs e)
        {
           
            PlayList.PalyAgain();
            
        }

        private void txtIng_TextChanged(object sender, EventArgs e)
        {
            //txtIng.Text = PlayList.PlaySongName();
        }

        private void txtNext_TextChanged(object sender, EventArgs e)
        {
           // txtNext.Text = PlayList.NextSongName();
        }
        
        private void timer2_Tick(object sender, EventArgs e)
        {
           
        }
        //原唱伴唱(可惜没实现)
        private void button1_Click(object sender, EventArgs e)
        {
            if (Player2.settings.balance==100)
            {
                Player2.settings.balance = -100;
            }
            else
            {
                Player2.settings.balance = 100;
            }
        }
       
    }
}

   2.歌星点歌(三个listview的集成窗体)

     01.歌手类别

    

ktv管理系统java ktv管理系统主要功能_System_02

     02.歌手地区

     

ktv管理系统java ktv管理系统主要功能_Click_03

 

     03.歌手姓名

    

ktv管理系统java ktv管理系统主要功能_System_04

  

    04.代码

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace MyKTV
{
    public partial class frmGXDG1 : Form
    {
        public frmGXDG1()
        {
            InitializeComponent();
        }
        public int a = 1;//三个listview标示
        public int typeid = 0;
        public string sex = "组合";
        public  frmMain form1 = null;
        private void frmGXDG1_Load(object sender, EventArgs e)
        {
            this.listView2.Visible = false;
            this.listView3.Visible = false;
        }
        //动态加载第二个listView五个图片
        private void listView1_Click(object sender, EventArgs e)
        {
            a = 2;
            if (listView1.SelectedItems[0]!=null)
            {
                listView2.Visible = true;
                listView2.Location = listView1.Location;
                //记录第一个listview所选类型
                sex = listView1.SelectedItems[0].Tag.ToString();
            }
            string sql = "select singercountryid,singercountryname from singercountry";
            SqlConnection con = new SqlConnection(SqlUtil.str);
            SqlCommand com = new SqlCommand(sql, con);
            try
            {
                con.Open();
                SqlDataReader reader = com.ExecuteReader();
                
                listView2.Items.Clear();
                if (reader.HasRows)
                {
                    int num = 0;
                    while (reader.Read())
                    {
                        ListViewItem lv = new ListViewItem();
                        lv.Text = reader["singercountryname"].ToString();
                        lv.Tag = Convert.ToInt32(reader["singercountryid"]);
                       
                        lv.ImageIndex = num;
                        listView2.Items.Add(lv);
                        num++;
                    }
                    reader.Close();
                }
            }
            catch (Exception)
            {

                throw;
            }
            finally
            {
                con.Close();
            }
        }

        private void listView2_Click(object sender, EventArgs e)
        {
            a = 3;
            if (listView2.SelectedItems[0]!=null)
            {
                listView2.Visible = false;
                listView3.Visible = true;
                listView3.Location = listView2.Location;
                //保存所选择的地区编号
               typeid = Convert.ToInt32(listView2.SelectedItems[0].Tag);
                string result=sex;
                if (sex!="组合")
                {
                   result=sex ;
                }
                string sql = "select singername,singerphotourl,singerid from singerinfo where singercountryid='"+typeid+"' and singersex='"+result+"'";
                SqlConnection con = new SqlConnection(SqlUtil.str);
                SqlCommand com = new SqlCommand(sql,con);
                try
                {
                    con.Open();
                    SqlDataReader reader = com.ExecuteReader();
                    listView3.Items.Clear();//清空listview列表集合
                    if (reader.HasRows)
                    {
                        int num = 0;//添加的图片下标
                        imageList3.Images.Clear();//情况图片集合
                        
                        while (reader.Read())
                        {
                            //读取图片地址
                            string path = KTVUtil.picturePath + "\\" + reader["singerphotourl"].ToString();
                            //把读取出来的图片添加到imagelist3上
                            imageList3.Images.Add(Image.FromFile(path));
                            ListViewItem lv = new ListViewItem();
                            lv.Text=reader["singername"].ToString();
                            lv.Tag = Convert.ToInt32(reader["singerid"]);
                            lv.ImageIndex = num;
                            listView3.Items.Add(lv);
                            num++;
                        }
                    }
                }
                catch (Exception)
                {

                    throw;
                }
                finally
                {
                    con.Close();
                }
            }
        }

        private void listView3_Click(object sender, EventArgs e)
        {
            string sql = @"select singername,songname,songurl,songid from singerinfo as s,songinfo as f
                            where s.singerid=f.singerid and singername='"+listView3.SelectedItems[0].Text+"'";
           
            
            frmSongList fs = new frmSongList();
            fs.sql = sql;
            fs.Show();
            
        }

        private void tsbYD_Click(object sender, EventArgs e)
        {
            frmYiDian fy = frmYiDian.getFrm();
            fy.Show();
        }

        private void listView1_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void tsbFH_Click(object sender, EventArgs e)
        {
            if (a==2)
            {
                a = 1;
                this.listView1.Visible = true;
                this.listView2.Visible = false;
                this.listView3.Visible = false;
            }else 
            if (a==3)
            {
                a = 2;
                 listView2.Visible = true;
                listView1.Visible = false;
                listView3.Visible = false;
            }else
            if (a==1)
            {

                form1.Show();
               
               
            }
        }

        private void tsbTC_Click(object sender, EventArgs e)
        {
            form1.Show();
           
            this.Close();
        }

        private void listView3_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void tsbCC_Click(object sender, EventArgs e)
        {
            PlayList.PalyAgain();
        }
      
        private void tsbQG_Click(object sender, EventArgs e)
        {
                        DialogResult result = MessageBox.Show("确定要切歌吗?", "", MessageBoxButtons.YesNo);
                        if (result == DialogResult.Yes)
                        {
                            PlayList.Cutsong();
                        }
         }

       
    }
}

  05.歌曲列表

   

ktv管理系统java ktv管理系统主要功能_System_05

 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace MyKTV
{
    public partial class frmSongList : Form
    {
        public string sql = "";
        public int count = 0;
        public frmSongList()
        {
            InitializeComponent();
        }

        private void frmSongList_Load(object sender, EventArgs e)
        {
            if (count != 0)
            {
                string numsql = "select singername,songname,songurl,songid from singerinfo as s,songinfo as f where s.singerid=f.singerid and songcount=" + count + "";
                NewMethod(numsql);
            }
            else
            {
                NewMethod(sql);
            }
        }
        //加载frmSongList控件里dgvList数据
        private void NewMethod(string sql)
        {
            dgvList.AutoGenerateColumns = false;
            SqlConnection con = new SqlConnection(SqlUtil.str);
            SqlDataAdapter da = new SqlDataAdapter(sql, con);
            DataSet ds = new DataSet();
            da.Fill(ds);
            dgvList.DataSource = ds.Tables[0];
        }

        private void dgvList_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            //点击某首歌曲,并将选中的歌曲名和路径赋给该对象()
            Song song = new Song();
            song.SongName = dgvList.SelectedRows[0].Cells[0].Value.ToString();
           
            string a = dgvList.SelectedRows[0].Cells[2].Value.ToString();
            song.SongUrl=a;
            PlayList.AddSong(song);
            string name = dgvList.SelectedRows[0].Cells[0].Value.ToString();
            addCount(name);

        }
        public void addCount(string name)
        {
            SqlConnection con = new SqlConnection(SqlUtil.str);
            string sql = "update songinfo set songplaycount+=1 where songname='"+name+"'";
            SqlCommand com = new SqlCommand(sql,con);
            try
            {
                con.Open();
                int num = com.ExecuteNonQuery();
            }
            catch (Exception)
            {

                throw;
            }
            finally
            {
                con.Close();
            }
        }

        private void dgvList_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {

        }
    }
}

字数点歌

ktv管理系统java ktv管理系统主要功能_Text_06

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace MyKTV
{
    public partial class frmNum : Form
    {
        public frmNum()
        {
            InitializeComponent();
        }
        int count = 0;
        private void btn1_Click(object sender, EventArgs e)
        {
            count = Convert.ToInt32(btn1.Text);
            frmSongList fs = new frmSongList();
            fs.count = count;
            fs.Show();
           
        }

        private void btn2_Click(object sender, EventArgs e)
        {
            count = Convert.ToInt32(btn2.Text);
            frmSongList fs = new frmSongList();
            fs.count = count;
            fs.Show();
        }

        private void btn3_Click(object sender, EventArgs e)
        {
            count = Convert.ToInt32(btn3.Text);
            frmSongList fs = new frmSongList();
            fs.count = count;
            fs.Show();
        }

        private void btn4_Click(object sender, EventArgs e)
        {
            count = Convert.ToInt32(btn4.Text);
            frmSongList fs = new frmSongList();
            fs.count = count;
            fs.Show();
        }

        private void btn5_Click(object sender, EventArgs e)
        {
            count = Convert.ToInt32(btn5.Text);
            frmSongList fs = new frmSongList();
            fs.count = count;
            fs.Show();
        }

        private void btn6_Click(object sender, EventArgs e)
        {
            count = Convert.ToInt32(btn6.Text);
            frmSongList fs = new frmSongList();
            fs.count = count;
            fs.Show();
        }

        private void btn7_Click(object sender, EventArgs e)
        {
            count = Convert.ToInt32(btn7.Text);
            frmSongList fs = new frmSongList();
            fs.count = count;
            fs.Show();
        }

        private void btn8_Click(object sender, EventArgs e)
        {
            count = Convert.ToInt32(btn8.Text);
            frmSongList fs = new frmSongList();
            fs.count = count;
            fs.Show();
        }

        private void btn9_Click(object sender, EventArgs e)
        {
            count = Convert.ToInt32(btn9.Text);
            frmSongList fs = new frmSongList();
            fs.count = count;
            fs.Show();
        }

        private void toolStripButton2_Click(object sender, EventArgs e)
        {
            PlayList.PalyAgain();
        }

        private void toolStripButton1_Click(object sender, EventArgs e)
        {

        }

        private void toolStripButton3_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("确定要切歌吗?", "", MessageBoxButtons.YesNo);
            if (result == DialogResult.Yes)
            {
                PlayList.Cutsong();
            }
        }

        private void toolStripButton4_Click(object sender, EventArgs e)
        {
            frmYiDian fy = frmYiDian.getFrm();
            fy.Show();
        }

        private void frmNum_Load(object sender, EventArgs e)
        {

        }
    }
}

金榜排行

ktv管理系统java ktv管理系统主要功能_Click_07

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace MyKTV
{
    public partial class frmPaiHang : Form
    {
        public frmPaiHang()
        {
            InitializeComponent();
        }

        private void frmPaiHang_Load(object sender, EventArgs e)
        {
            Initial();
        }
        public void Initial()
        {
            SqlConnection con = new SqlConnection(SqlUtil.str);
            string sql = "select singername,songname,songplaycount,songurl from singerinfo as s,songinfo as f where s.singerid=f.singerid order by songplaycount desc";
            SqlCommand com = new SqlCommand(sql, con);
            try
            {
                con.Open();
                SqlDataReader reader = com.ExecuteReader();
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        string songname = Convert.ToString(reader["songname"]);
                        string singername = Convert.ToString(reader["singername"]);
                        int count = Convert.ToInt32(reader["songplaycount"]);
                        string songurl = Convert.ToString(reader["songurl"]);
                        ListViewItem lv = new ListViewItem(songname);
                        lv.SubItems.Add(singername);
                        lv.SubItems.Add(count.ToString());
                        lv.SubItems.Add(songurl);
                        lvPH1.Items.Add(lv);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                con.Close();
            }
        }

        private void toolStripButton4_Click(object sender, EventArgs e)
        {
            frmYiDian fy = frmYiDian.getFrm();
            fy.Show();
        }

        private void lvPH_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void lvPH_Click(object sender, EventArgs e)
        {
             
        }

        private void listView1_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void listView1_Click(object sender, EventArgs e)
        {
            Song song = new Song();
            song.SongName = lvPH1.SelectedItems[0].SubItems[0].Text;
            song.SongUrl = lvPH1.SelectedItems[0].SubItems[3].Text;
            PlayList.AddSong(song);
            frmSongList fs = new frmSongList();
            string name = lvPH1.SelectedItems[0].SubItems[0].Text;
            fs.addCount(name);
            this.lvPH1.Items.Clear(); 
            Initial();
            
        }

        private void toolStripButton2_Click(object sender, EventArgs e)
        {
            PlayList.PalyAgain();
        }

        private void toolStripButton3_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("确定要切歌吗?", "", MessageBoxButtons.YesNo);
            if (result == DialogResult.Yes)
            {
                PlayList.Cutsong();
            }
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            this.lvPH1.Items.Clear(); ;
            Initial();
        }
    }
}

类型点歌

ktv管理系统java ktv管理系统主要功能_Click_08

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace MyKTV
{
    public partial class frmType : Form
    {
        public frmType()
        {
            InitializeComponent();
        }
        private Song song;//当前播放的歌曲
        public void getSong(Song so){
            this.song=so;
        }
        private void lvType_SelectedIndexChanged(object sender, EventArgs e)
        {

        }
        //类型点歌
        private void lvType_Click(object sender, EventArgs e)
        {
            string sql = "select singername,songname,songurl,songid from singerinfo as s,songinfo as f where s.singerid=f.singerid and songtype='" +lvType.SelectedItems[0].Text+ "'";
            frmSongList fs = new frmSongList();
            fs.sql = sql;
            fs.Show();
        }

        private void toolStripButton4_Click(object sender, EventArgs e)
        {
            frmYiDian fy = frmYiDian.getFrm();
            fy.Show();
        }

        private void frmType_Load(object sender, EventArgs e)
        {

        }

        private void toolStripButton2_Click(object sender, EventArgs e)
        {
            PlayList.PalyAgain();
        }

        private void toolStripButton3_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("确定要切歌吗?", "", MessageBoxButtons.YesNo);
            if (result == DialogResult.Yes)
            {
                PlayList.Cutsong();
            }
        }
    }
}

拼音点歌

ktv管理系统java ktv管理系统主要功能_Click_09

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace MyKTV
{
    public partial class frmPY : Form
    {
        public frmPY()
        {
            InitializeComponent();
        }
        public string py = "";

        private void butA_Click(object sender, EventArgs e)
        {
            py += btnA.Text;
            txtPY.Text = py;
            select();
        }

        private void butB_Click(object sender, EventArgs e)
        {
            py += btnB.Text;
            txtPY.Text = py;
            select();
        }

        private void butC_Click(object sender, EventArgs e)
        {
            py += btnC.Text;
            txtPY.Text = py;
            select();
        }

        private void btnD_Click(object sender, EventArgs e)
        {
            py += btnD.Text;
            txtPY.Text = py;
            select();
        }

        private void btnE_Click(object sender, EventArgs e)
        {
            py += btnE.Text;
            txtPY.Text = py;
            select();
        }

        private void btnF_Click(object sender, EventArgs e)
        {
            py += btnF.Text;
            txtPY.Text = py;
            select();
        }

        private void btnG_Click(object sender, EventArgs e)
        {
            py += btnG.Text;
            txtPY.Text = py;
            select();
        }

        private void btnH_Click(object sender, EventArgs e)
        {
           
        }

        private void btnI_Click(object sender, EventArgs e)
        {
            py += btnI.Text;
            txtPY.Text = py;
            select();
        }
        private void btnK_Click(object sender, EventArgs e)
        {
            py += btnK.Text;
         txtPY.Text = py;
         select();
        }

        private void btnL_Click(object sender, EventArgs e)
        {
            py += btnL.Text;
         txtPY.Text = py;
         select();
        }

        private void btnM_Click(object sender, EventArgs e)
        {
            py += btnM.Text;
         txtPY.Text = py;
         select();
        }

        private void btnN_Click(object sender, EventArgs e)
        {
            py += btnN.Text;
             txtPY.Text = py;
             select();
        }

        private void btnO_Click(object sender, EventArgs e)
        {
            py += btnO.Text;
             txtPY.Text = py;
             select();
        }

        private void btnP_Click(object sender, EventArgs e)
        {
            py += btnP.Text;
         txtPY.Text = py;
         select();
        }

        private void btnQ_Click(object sender, EventArgs e)
        {
            py += btnQ.Text;
             txtPY.Text = py;
             select();
        }

        private void btnR_Click(object sender, EventArgs e)
        {
            py += btnR.Text;
             txtPY.Text = py;
             select();
        }

        private void btnS_Click(object sender, EventArgs e)
        {
            py += btnS.Text;
             txtPY.Text = py;
             select();
        }

        private void btnT_Click(object sender, EventArgs e)
        {
            py += btnT.Text;
             txtPY.Text = py;
             select();
        }

        private void btnU_Click(object sender, EventArgs e)
        {
            py += btnU.Text;
             txtPY.Text = py;
             select();
        }

        private void btnV_Click(object sender, EventArgs e)
        {
            py += btnV.Text;
             txtPY.Text = py;
             select();
        }

        private void btnW_Click(object sender, EventArgs e)
        {
            py += btnW.Text;
             txtPY.Text = py;
             select();
        }

        private void btnX_Click(object sender, EventArgs e)
        {
            py += btnX.Text;
             txtPY.Text = py;
             select();
        }

        private void btnY_Click(object sender, EventArgs e)
        {
            py += btnY.Text;
             txtPY.Text = py;
             select();
        }

        private void btnZ_Click(object sender, EventArgs e)
        {
            py += btnZ.Text;
             txtPY.Text = py;
             select();
        }

        private void btnJ_Click(object sender, EventArgs e)
        {
            py += btnJ.Text;
            txtPY.Text = py;
            select();
        }

        private void btnPY_Click(object sender, EventArgs e)
        {
            int length = py.Length;
            if (length>0)
            {
                py = py.Substring(0,length-1);
            txtPY.Text = py;
            select(); 
            }
            
        }
        //拼音模糊查询
        public void  select() {
            dgvPY.AutoGenerateColumns = false;
            string sql = @"select singername,songname,songurl,songid from singerinfo as s,songinfo as f
                            where s.singerid=f.singerid and songab like '" + txtPY.Text + "%'";
            SqlConnection con = new SqlConnection(SqlUtil.str);
            SqlDataAdapter da = new SqlDataAdapter(sql, con);
            DataSet ds = new DataSet();
            da.Fill(ds);
            dgvPY.DataSource = ds.Tables[0];
        }

        private void txtPY_TextChanged(object sender, EventArgs e)
        {
            select();
        }

        private void btnH_Click_1(object sender, EventArgs e)
        {
            py += btnH.Text;
            txtPY.Text = py;
            select();
        }

        private void toolStripButton4_Click(object sender, EventArgs e)
        {
            frmYiDian fy = frmYiDian.getFrm();
            fy.Show();
        }

        private void dgvPY_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            Song song = new Song();
            song.SongName = dgvPY.SelectedRows[0].Cells[0].Value.ToString();
           
            string a = dgvPY.SelectedRows[0].Cells[2].Value.ToString();
            song.SongUrl = a;

            PlayList.AddSong(song);
        }

        private void frmPY_Load(object sender, EventArgs e)
        {

        }

        private void panel1_Paint(object sender, PaintEventArgs e)
        {

        }

        private void toolStripButton2_Click(object sender, EventArgs e)
        {
            PlayList.PalyAgain();
        }

        private void toolStripButton3_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("确定要切歌吗?", "", MessageBoxButtons.YesNo);
            if (result == DialogResult.Yes)
            {
                PlayList.Cutsong();
            }
        }
        }
    
}

已点列表

ktv管理系统java ktv管理系统主要功能_ktv管理系统java_10

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace MyKTV
{
    public partial class frmYiDian : Form
    {
        private frmYiDian()
        {
            InitializeComponent();
        }
        public static frmYiDian frm;
        public static frmYiDian getFrm()
        {
            if (frm==null)
            {
                frm = new frmYiDian();
            }
            return frm;
        }

        public static int style = 1;
        private void lvYiDian_SelectedIndexChanged(object sender, EventArgs e)
        {
         
        }
        public void RefreshSongList()
        {
            lvYiDian.Items.Clear();//清空原列表
            for (int i = 0; i < PlayList.SongList.Length; i++)
            {
                if (PlayList.SongList[i]!=null)
                {
                    ListViewItem item = new ListViewItem(PlayList.SongList[i].SongName);
                    item.Tag = i;
                    //获取播放状态
                    string bofang = PlayList.SongList[i].PlayStar == SongPlayState.unplayer ? "未播放" : "已播放";
                    item.SubItems.Add(bofang);
                    lvYiDian.Items.Add(item);
                }
            }
        }

        private void frmYiDian_Load(object sender, EventArgs e)
        {
            style = 0;
            RefreshSongList();
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            RefreshSongList();
        }

        private void frmYiDian_FormClosing(object sender, FormClosingEventArgs e)
        {
            style = 1;
        }

        private void 切歌ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("确定要切歌吗?", "", MessageBoxButtons.YesNo);
            if (result == DialogResult.Yes)
            {
                PlayList.Cutsong();
            }
        }

        private void 重唱ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            PlayList.PalyAgain();
        }

    }
}

 

using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;using System.Data.SqlClient;namespace MyKTV{    public partial class frmMain : Form    {        public frmMain()        {            //InitializeComponent();        }
        private void btnGX_Click(object sender, EventArgs e)        {            frmGXDG1 fg = new frmGXDG1();            fg.form1 = this;            fg.Show();            this.Hide();        }        //获取歌曲路径        public void SongPath()        {            string sql = "select resourcepath from resourcepath where resourceid=1";            SqlConnection con = new SqlConnection(SqlUtil.str);            SqlCommand com = new SqlCommand(sql, con);            try            {                con.Open();                KTVUtil.songPath= com.ExecuteScalar().ToString();            }            catch (Exception)            {
                throw;            }            finally            {                con.Close();            }        }        private void frmMain_Load(object sender, EventArgs e)        {                        //读取歌曲路径            SongPath();            //读取resourcepath表中的歌手图片            string sql = "select resourcepath from resourcepath where resourceid=2";            SqlConnection con = new SqlConnection(SqlUtil.str);            SqlCommand com = new SqlCommand(sql,con);            try            {                con.Open();                KTVUtil.picturePath=com.ExecuteScalar().ToString();            }            catch (Exception)            {
                throw;            }            finally            {                con.Close();            }        }        private Song song;//当前播放的歌曲        //播放歌曲        public void PlaySong()        {            //调用播放当前歌曲方法            this.song = PlayList.GetPlaySong();            if (song!=null)            {                //改变播放状态为播放                this.song.SongPlayed();                Player2.URL = KTVUtil.songPath + "\\" + this.song.SongUrl;                               txtIng.Text = PlayList.PlaySongName();                            }        }
        private void btnPY_Click(object sender, EventArgs e)        {            frmPY fp = new frmPY();            fp.Show();        }
        private void btnSZ_Click(object sender, EventArgs e)        {            frmNum fn = new frmNum();            fn.Show();        }
        private void btnLX_Click(object sender, EventArgs e)        {            frmType ft = new frmType();            ft.getSong(song);                        ft.Show();        }
        private void btnJB_Click(object sender, EventArgs e)        {            frmPaiHang fp = new frmPaiHang();            fp.Show();        }                 private void toolStripButton3_Click(object sender, EventArgs e)        {
                frmYiDian fy = frmYiDian.getFrm();                fy.Show();                                }
        private void panel2_Paint(object sender, PaintEventArgs e)        {
        }       public static int cutSong = 0;       private void timer1_Tick(object sender, EventArgs e)       {           String nextSongName = PlayList.NextSongName();           txtNext.Text = nextSongName;           if (song == null)           {               PlaySong();           }           if (Player2.playState == WMPLib.WMPPlayState.wmppsStopped)           {               song = null;               PlayList.Next();           }           if (song != null && this.song.PlayStar == SongPlayState.cut)           {               this.song = null;           }           if (song != null)           {               if (this.song.PlayStar == SongPlayState.again)               {                   this.song = null;               }           }       }        private void toolStripButton5_Click(object sender, EventArgs e)        {            Application.Exit();        }
        private void Player2_Enter(object sender, EventArgs e)        {
        }
        private void timNow_Tick(object sender, EventArgs e)        {                              }
        private void toolStripButton2_Click(object sender, EventArgs e)        {
            DialogResult result = MessageBox.Show("确定要切歌吗?", "", MessageBoxButtons.YesNo);            if (result==DialogResult.Yes)            {                PlayList.Cutsong();             }                   }
        private void toolStripButton1_Click(object sender, EventArgs e)        {                       PlayList.PalyAgain();                    }
        private void txtIng_TextChanged(object sender, EventArgs e)        {            //txtIng.Text = PlayList.PlaySongName();        }
        private void txtNext_TextChanged(object sender, EventArgs e)        {           // txtNext.Text = PlayList.NextSongName();        }                private void timer2_Tick(object sender, EventArgs e)        {                   }        //原唱伴唱(可惜没实现)        private void button1_Click(object sender, EventArgs e)        {            if (Player2.settings.balance==100)            {                Player2.settings.balance = -100;            }            else            {                Player2.settings.balance = 100;            }        }           }}