星空网 > 软件开发 > ASP.net

KTV点歌系统

KTV点歌系统————北大青鸟  指导老师:原玉明

KTV点歌系统

 

KTV点歌系统

 1 public enum SongPlayState 2   { 3     //未播放,播放,重播,切歌 4     unplayed, played, again, cut 5   } 6   public class Song 7   { 8     public string SongName { get; set; }//歌曲名称 9 10     public string SongURL { get; set; }//歌曲路径11 12    13     public SongPlayState playState = SongPlayState.unplayed;//默认未播放14     internal SongPlayState PlayState { get; set; }15 16     //状态为已播17     public void SetSongPlayed()18     {19       this.PlayState = SongPlayState.played;20     }21     //重唱22     public void SetPlayAgain()23     {24       this.playState = SongPlayState.again;25     }26    //切歌27     public void SetSongCut()28     {29       this.playState = SongPlayState.cut;30     }

 

 

PlayList类中实现切歌 重唱 下一首 等.....

 1 public class PlayList 2   { 3     //定义一个长度为、50的歌曲数组,默认存储50首歌曲 4     public static Song[] SongList = new Song[50]; 5     public static int SongIndex = 0;//当前播放的歌曲在数组中的索引 6     //点播一首歌曲,其实是将歌曲对象添加到歌曲数组中 7     public static bool AddSong(Song song) 8     { 9       bool success = false;//记录添加歌曲是否成功 10       for (int i = 0; i < SongList.Length; i++) 11       { 12         //找到数组中第一个为null的位置 13         if (SongList[i] == null) 14         { 15           SongList[i] = song; 16           success = true; 17           break; 18         } 19       } 20       return success; 21     } 22     //获取当前播放的歌曲::既然是获取当前播放的歌曲,返回值肯定是Song类型 23     public static Song GetPlaySong() 24     { 25       if (SongList[SongIndex] != null) 26       { 27         return SongList[SongIndex]; 28       } 29       else 30       { 31         return null; 32       } 33     } 34     /// <summary> 35     /// 播放下一首 36     /// </summary> 37     public static void MoveOn() 38     { 39       if (SongList[SongIndex] != null && SongList[SongIndex].PlayState == SongPlayState.again) 40       { 41         SongList[SongIndex].SetSongPlayed(); 42       } 43       else 44       { 45         SongIndex++; 46       } 47     } 48     /// <summary> 49     /// 当前播放的歌曲名称 50     /// </summary> 51     /// <returns>歌曲名称</returns> 52     public static string PlayingSongName() 53     { 54       string songName = ""; // 歌曲名称 55       if (SongList[SongIndex] != null) 56       { 57         songName = SongList[SongIndex].SongName; 58       } 59  60       return songName; 61     } 62     /// <summary> 63     /// 下一首要播放的歌曲名称 64     /// </summary> 65     /// <returns>歌曲名称</returns> 66     public static string NextSongName() 67     { 68       string songName = ""; // 歌曲名称 69       if (SongList[SongIndex + 1] != null) 70       { 71         songName = SongList[SongIndex + 1].SongName; 72       } 73  74       return songName; 75     } 76     //重放当前歌曲 77     public static void PlayAgain() 78     { 79       if (SongList[SongIndex] != null) 80       { 81         SongList[SongIndex].SetPlayAgain(); 82       } 83     } 84     //切歌 85     public static void CutSong(int index) 86     { 87       int i;//循环变量,代表切歌的位置 88       if (index == -1)//循环变量,代表切割的位置 89       { 90         i = SongIndex; 91       } 92       else 93       { 94         i = index;//从切歌的位置开始,将歌曲逐个向前移一个位置 95       } 96       SongList[i].SetSongCut(); 97       while (SongList[i] != null) 98       { 99         SongList[i] = SongList[i + 1];100         i++; 101         //如果达到数组最后一个元素,就将最后一个元素指向空102         if (i == SongList.Length)103         {104           SongList[i] = null;105         }106       }107     }108   }

 实现歌手点歌

KTV点歌系统

 1 public FrmMain frmMain; 2     string connectionStr = "server=.;database=MyKTV;uid=sa"; 3     DBHelp db = new DBHelp(); 4     private SqlConnection con; 5     //首先要查出数据库中的图片路径和歌曲路径 6     private void FrmCountry_Load(object sender, EventArgs e) 7     { 8        9       con = new SqlConnection(connectionStr); 10       con.Open(); 11       string sql = "select resource_path from resource_path where resource_id=1"; 12  13       string sqlsongpath = "select resource_path from resource_path where resource_id=2"; 14       SqlCommand cmd = new SqlCommand(sql,con); 15  16       SqlCommand cmd2 = new SqlCommand(sqlsongpath, con); 17       KtvUnit.ImagePath = cmd.ExecuteScalar().ToString(); 18       KtvUnit.SongPath = cmd2.ExecuteScalar().ToString(); 19       con.Close(); 20     } 21     //点击歌手男女或组合时 22     private void LvOne_Click(object sender, EventArgs e) 23     { 24       25       LoadSingerArea(); 26     } 27     public string singer_type { get; set; } 28     private void LoadSingerArea() 29     { 30       if (this.LvOne.SelectedItems[0] != null) 31       { 32         LvOne.Visible = false; 33         LvTwo.Location = LvOne.Location; 34         LvTwo.Dock = DockStyle.Fill; 35         LvTwo.Visible = true; 36         this.singer_type=Convert.ToString(LvOne.SelectedItems[0].Text); 37       } 38       39       con = new SqlConnection(connectionStr); 40       string sql = "select singertype_id,singertype_name from singer_type"; 41       SqlCommand cmd = new SqlCommand(sql, con); 42       SqlDataReader dr; 43       try 44       { 45         con.Open(); 46         LvTwo.Items.Clear(); 47         dr = cmd.ExecuteReader();        48         if (dr.HasRows) 49         { 50           int index = 0; 51           while (dr.Read()) 52           { 53             ListViewItem lvItem = new ListViewItem(); 54             int typeid = Convert.ToInt32(dr["singertype_id"]); 55             string typename = Convert.ToString(dr["singertype_name"]); 56             lvItem.Text = typename; 57             lvItem.Tag = typeid; 58             lvItem.ImageIndex = index; 59             LvTwo.Items.Add(lvItem); 60             index++; 61           } 62         } 63         dr.Close(); 64       } 65       catch (Exception ex) 66       { 67  68         MessageBox.Show("系统出现异常" + ex.Message); 69       } 70       finally  71       { 72         con.Close(); 73       } 74     } 75     public string singertype_id { get; set; } 76     /// <summary> 77     /// 点击地区类型时 78     /// </summary> 79     /// <param name="sender"></param> 80     /// <param name="e"></param> 81     private void LvTwo_Click(object sender, EventArgs e) 82     { 83       if (this.LvTwo.SelectedItems[0] != null) 84       { 85         LvTwo.Visible = false; 86         Lvthree.Location = LvTwo.Location; 87         Lvthree.Dock = DockStyle.Fill; 88         Lvthree.Visible = true; 89         this.singertype_id = Convert.ToString(LvTwo.SelectedItems[0].Tag); 90       } 91       string result = singer_type; 92       if (result != "组合") 93       { 94         result = singer_type == "女歌手" ? "女" : "男"; 95       } 96       con = new SqlConnection(connectionStr); 97       string sql =string.Format( "select singer_id,singer_name,singer_photo_url from singer_info where singertype_id={0} and singer_Sex='{1}'",singertype_id,result); 98       SqlCommand cmd = new SqlCommand(sql, con); 99       SqlDataReader dr;100       try101       {102         con.Open();103         int index = 0;104         Lvthree.Items.Clear();105         imageList3.Images.Clear();106         dr = cmd.ExecuteReader();107         if (dr.HasRows)108         { 109           while (dr.Read())110           {            111             string photoURL =KtvUnit.ImagePath + Convert.ToString(dr["singer_photo_url"]);112             //先给ImageList填充图片113             imageList3.Images.Add(Image.FromFile(photoURL));114             ListViewItem lvItem = new ListViewItem();115             lvItem.Text = Convert.ToString(dr["singer_name"]);116             lvItem.Tag = Convert.ToString(dr["singer_id"]);117             lvItem.ImageIndex = index;118             Lvthree.Items.Add(lvItem);119             index++;120           }121         }122         dr.Close();123       }124       catch (Exception ex)125       {126 127         MessageBox.Show("系统出现异常" + ex.Message);128       }129       finally130       {131         con.Close();132       }133     }134 135     public void SongList()136     {137       //读取数据库,读出该歌手的所有歌曲138 139       StringBuilder sb = new StringBuilder();140       //拼接SQL语句141       sb.AppendFormat("select song_id,song_name,song_url,singer_name from song_info,singer_info where singer_name='{0}' and song_info.singer_id={1}", Lvthree.SelectedItems[0].Text, Convert.ToInt32(Lvthree.SelectedItems[0].Tag));142       FrmSongList songList = new FrmSongList();143      144       songList.Sql = sb.ToString();145       songList.Previous = KtvClient.PrevioisForm.Singer;//指定返回的窗体是按歌手点歌146       songList.ShowDialog();147       this.Close();148 149     }150 151     private void Lvthree_Click(object sender, EventArgs e)152     {153       SongList();154     }155 156     private void tsSingerMain_Click(object sender, EventArgs e)157     {158       FrmMain main = new FrmMain();159       main.Show();160       this.Hide();161     }162 163     private void tsSingerBack_Click(object sender, EventArgs e)164     {165       if (this.LvOne.Visible==true)166       {167         FrmMain man = new FrmMain();168         man.Show();169         this.Hide();170       }171       else if (this.LvTwo.Visible==true)172       {173         this.LvTwo.Visible = false;174         this.LvOne.Visible = true;175       }176       else if (this.Lvthree.Visible==true)177       {178         this.Lvthree.Visible = false;179         this.LvTwo.Visible = true;180       }181     }182 183     private void tsSingerCut_Click(object sender, EventArgs e)184     {185       PlayList.CutSong(-1);186     }187 188     private void tsSingerAgain_Click(object sender, EventArgs e)189     {190       PlayList.PlayAgain();191     }192 193     private void tsSingerYidian_Click(object sender, EventArgs e)194     {195       FrmPlayList frm = new FrmPlayList();196       frm.Show();197     }

拼音点歌

KTV点歌系统

 

 1 public FrmMain frmMain; 2     [DllImportAttribute("user32.dll")] 3     private static extern bool AnimateWindow(IntPtr hwnd, int dwTime, int dwFlags); 4     DBHelp db = new DBHelp(); 5     string connectionStr = "server=.;database=MyKTV;uid=sa"; 6     private void FrmPinYin_Load(object sender, EventArgs e) 7     { 8       AnimateWindow(this.Handle, 300, FrmMain.AW_SLIDE + FrmMain.AW_VER_POSITIVE); 9       SqlConnection con = new SqlConnection(connectionStr); 10       con.Open(); 11       db.connection();   12       string sqlsongpath = "select resource_path from resource_path where resource_id=2"; 13       SqlCommand cmd = new SqlCommand(sqlsongpath, con); 14       KtvUnit.SongPath = cmd.ExecuteScalar().ToString(); 15     } 16     private void btnSearch_Click(object sender, EventArgs e) 17     { 18       string PinYin = this.txtPinYin.Text; 19       //判断是否是中文 还是拼音 20       if (!Regex.IsMatch(this.txtPinYin.Text, @"^[\u4e00-\u9fa5]+$")) 21       { 22         StringBuilder PY = new StringBuilder(PinYin); 23         24         for (int i = 0; i <= PY.Length; i++) 25         { 26           PY.Insert(i, "%"); 27           i++; 28         } 29         string sql = string.Format("SELECT song_name,singer_name FROM  dbo.singer_info, dbo.song_info WHERE dbo.singer_info.singer_id=dbo.song_info.singer_id AND song_ab LIKE '{0}'", PY); 30         this.dgvPinYinInfo.DataSource = db.dataTable(sql,"PY"); 31       } 32       else 33       { 34         StringBuilder ZW = new StringBuilder(PinYin); 35         for (int i = 0; i < ZW.Length; i++) 36         { 37           ZW.Insert(i,"%"); 38           i++; 39         } 40         string sql = string.Format("SELECT song_name,singer_name FROM  dbo.singer_info, dbo.song_info WHERE dbo.singer_info.singer_id=dbo.song_info.singer_id AND song_name LIKE '{0}'", ZW); 41         this.dgvPinYinInfo.DataSource = db.dataTable(sql, "PY"); 42       } 43     } 44  45     private void dgvPinYinInfo_DoubleClick(object sender, EventArgs e) 46     { 47       string songname = this.dgvPinYinInfo.SelectedRows[0].Cells["song_name"].Value.ToString(); 48       DBHelp db = new DBHelp(); 49       db.connection(); 50       string sql = string.Format("SELECT song_name,singer_name,song_url,song_photo_url FROM dbo.song_info,dbo.singer_info where dbo.singer_info.singer_id=dbo.song_info.singer_id and song_name='{0}'",songname); 51  52       SqlDataReader reader = db.ExecuteReaders(sql.ToString()); 53  54       Song song; 55       if (reader.Read()) 56       { 57         song = new Song(); 58         song.SongName = reader["song_name"].ToString(); 59         song.SongURL = KtvUnit.SongPath+reader["song_url"].ToString(); 60         PlayList.AddSong(song);        61       } 62       reader.Close(); 63     } 64  65     private void pictureBox2_Click(object sender, EventArgs e) 66     { 67       textBox1.Text = textBox1.Text + "a"; 68     } 69  70     private void pictureBox1_Click(object sender, EventArgs e) 71     { 72       textBox1.Text = textBox1.Text + "b"; 73     } 74  75     private void pictureBox3_Click(object sender, EventArgs e) 76     { 77       textBox1.Text = textBox1.Text + "c"; 78     } 79  80     private void pictureBox4_Click(object sender, EventArgs e) 81     { 82       textBox1.Text = textBox1.Text + "d"; 83     } 84  85     private void pictureBox5_Click(object sender, EventArgs e) 86     { 87       textBox1.Text = textBox1.Text + "e"; 88     } 89  90     private void pictureBox6_Click(object sender, EventArgs e) 91     { 92       textBox1.Text = textBox1.Text + "f"; 93     } 94  95     private void pictureBox7_Click(object sender, EventArgs e) 96     { 97       textBox1.Text = textBox1.Text + "g"; 98     } 99 100     private void pictureBox8_Click(object sender, EventArgs e)101     {102       textBox1.Text = textBox1.Text + "h";103     }104 105     private void pictureBox9_Click(object sender, EventArgs e)106     {107       textBox1.Text = textBox1.Text + "i";108     }109 110     private void pictureBox10_Click(object sender, EventArgs e)111     {112       textBox1.Text = textBox1.Text + "j";113     }114 115     private void pictureBox26_Click(object sender, EventArgs e)116     {117       textBox1.Text = textBox1.Text + "k";118     }119 120     private void pictureBox11_Click(object sender, EventArgs e)121     {122       textBox1.Text = textBox1.Text + "l";123     }124 125     private void pictureBox12_Click(object sender, EventArgs e)126     {127       textBox1.Text = textBox1.Text + "m";128     }129 130     private void pictureBox13_Click(object sender, EventArgs e)131     {132       textBox1.Text = textBox1.Text + "n";133     }134 135     private void pictureBox14_Click(object sender, EventArgs e)136     {137       textBox1.Text = textBox1.Text + "o";138     }139 140     private void pictureBox15_Click(object sender, EventArgs e)141     {142       textBox1.Text = textBox1.Text + "p";143     }144 145     private void pictureBox16_Click(object sender, EventArgs e)146     {147       textBox1.Text = textBox1.Text + "q";148     }149 150     private void pictureBox17_Click(object sender, EventArgs e)151     {152       textBox1.Text = textBox1.Text + "r";153     }154 155     private void pictureBox18_Click(object sender, EventArgs e)156     {157       textBox1.Text = textBox1.Text + "s";158     }159 160     private void pictureBox19_Click(object sender, EventArgs e)161     {162       textBox1.Text = textBox1.Text + "t";163     }164 165     private void pictureBox20_Click(object sender, EventArgs e)166     {167       textBox1.Text = textBox1.Text + "u";168     }169 170     private void pictureBox21_Click(object sender, EventArgs e)171     {172       textBox1.Text = textBox1.Text + "v";173     }174 175     private void pictureBox22_Click(object sender, EventArgs e)176     {177       textBox1.Text = textBox1.Text + "w";178     }179 180     private void pictureBox23_Click(object sender, EventArgs e)181     {182       textBox1.Text = textBox1.Text + "x";183     }184 185     private void pictureBox24_Click(object sender, EventArgs e)186     {187       textBox1.Text = textBox1.Text + "y";188     }189 190     private void pictureBox25_Click(object sender, EventArgs e)191     {192       textBox1.Text = textBox1.Text + "z";193     }194 195     private void FrmPinYin_FormClosing(object sender, FormClosingEventArgs e)196     {197       AnimateWindow(this.Handle, 300, FrmMain.AW_SLIDE + FrmMain.AW_VER_POSITIVE);198     }199     public void Binder() 200     {201       string PinYin = this.textBox1.Text;202       StringBuilder PY = new StringBuilder(PinYin);203      204       for (int i = 0; i <= PY.Length; i++)205       {206         PY.Insert(i, "%");207         i++;208       }209       string sql = string.Format("SELECT song_name,singer_name FROM  dbo.singer_info, dbo.song_info WHERE dbo.singer_info.singer_id=dbo.song_info.singer_id AND song_ab LIKE '{0}'", PY);210       DataSet ds = db.dataSet(sql, "PY");211       if (ds.Tables["PY"]!=null)212       {213         ds.Tables["PY"].Clear();214       }215       this.dgvPinYinInfo.DataSource = db.dataTable(sql, "PY");216     }217     private void pictureBox28_Click(object sender, EventArgs e)218     {219       string text = textBox1.Text;220       int index = text.Length - 1;221       if (index >= 0)222       {223         textBox1.Text = text.Remove(index);224       }225     }226 227     private void textBox1_TextChanged(object sender, EventArgs e)228     {229       if (textBox1.Text!=string.Empty)230       {231         Binder();232         this.dgvPinYinInfo.AutoGenerateColumns = false;233       }234       else235       {236         this.dgvPinYinInfo.DataSource=null;237       }238 239     }240 241    242 243     private void tsPYMain_Click(object sender, EventArgs e)244     {245       FrmMain main = new FrmMain();246       main.Show();247       this.Hide();248     }249 250     private void txPYAgain_Click(object sender, EventArgs e)251     {252       FrmMain main = new FrmMain();253       main.Playsong();254     }255     Song song = new Song();256     private void tsPYCut_Click(object sender, EventArgs e)257     {258       song.playState = SongPlayState.cut;259     }260 261     private void tsPYYidian_Click(object sender, EventArgs e)262     {263       FrmPlayList list = new FrmPlayList();264       list.Show();265     }266 267     private void tsPYBack_Click(object sender, EventArgs e)268     {269       Application.Exit();270     }    

类型点歌

 1  public FrmMain frmMain; 2     string connectionStr = "server=.;database=MyKTV;uid=sa"; 3     DBHelp db = new DBHelp(); 4     private SqlConnection con; 5     private void FrmSongType_Load(object sender, EventArgs e) 6     { 7       con = new SqlConnection(connectionStr); 8       con.Open(); 9       string sql = "select resource_path from resource_path where resource_id=1"; 10       string sqlsongpath = "select resource_path from resource_path where resource_id=2"; 11       SqlCommand cmd2 = new SqlCommand(sqlsongpath,con); 12       KtvUnit.SongPath = cmd2.ExecuteScalar().ToString(); 13       SqlCommand cmd = new SqlCommand(sql, con); 14       KtvUnit.ImagePath = cmd.ExecuteScalar().ToString(); 15       con.Close(); 16     17       con = new SqlConnection(connectionStr); 18       string sql1 = string.Format("select songtype_id,songtype_name,songtype_URL from song_type"); 19       SqlCommand cmd1 = new SqlCommand(sql1, con); 20       SqlDataReader dr; 21       try 22       { 23         con.Open(); 24         int index = 0; 25         lvSongType.Items.Clear(); 26         imageList1.Images.Clear(); 27         dr = cmd1.ExecuteReader(); 28         if (dr.HasRows) 29         { 30           while (dr.Read()) 31           { 32             string photoURL = KtvUnit.ImagePath + Convert.ToString(dr["songtype_URL"]); 33             //先给ImageList填充图片 34             imageList1.Images.Add(Image.FromFile(photoURL)); 35             ListViewItem lvItem = new ListViewItem(); 36             lvItem.Text = Convert.ToString(dr["songtype_name"]); 37             lvItem.Tag = Convert.ToString(dr["songtype_id"]); 38             lvItem.ImageIndex = index; 39             lvSongType.Items.Add(lvItem); 40             index++; 41           } 42         } 43         dr.Close(); 44       } 45       catch (Exception ex) 46       { 47  48         MessageBox.Show("系统出现异常" + ex.Message); 49       } 50       finally 51       { 52         con.Close(); 53       } 54     } 55     private void LoadSongType() 56     { 57       //读取数据库,读出该歌曲类型的所有歌曲 58  59       StringBuilder sb = new StringBuilder(); 60       //拼接SQL语句 61       sb.AppendFormat("select song_info.song_name,singer_info.singer_name,song_info.song_url from singer_info,song_info where song_info.singer_id=singer_info.singer_id and song_info.songtype_id={0}", Convert.ToInt32(lvSongType.SelectedItems[0].Tag)); 62       FrmSongList songList = new FrmSongList(); 63  64       songList.Sql = sb.ToString(); 65       songList.Previous = KtvClient.PrevioisForm.SongType;//指定返回的窗体是按歌曲类型点歌 66       songList.ShowDialog(); 67       this.Close(); 68     } 69  70     private void lvSongType_Click(object sender, EventArgs e) 71     { 72       LoadSongType(); 73     } 74  75     private void tsTYSingerMain_Click(object sender, EventArgs e) 76     { 77       FrmMain main = new FrmMain(); 78       main.Show(); 79       this.Hide(); 80     } 81  82     private void tsTYSingerAgain_Click(object sender, EventArgs e) 83     { 84       FrmMain main = new FrmMain(); 85       main.Playsong(); 86     } 87     Song song = new Song(); 88     private void tsTYSingerCut_Click(object sender, EventArgs e) 89     { 90       song.playState = SongPlayState.cut; 91     } 92  93     private void tsTYSingerYidian_Click(object sender, EventArgs e) 94     { 95       FrmPlayList list = new FrmPlayList(); 96       list.Show(); 97     } 98  99     private void tsTYSingerBack_Click(object sender, EventArgs e)100     {101       FrmMain main = new FrmMain();102       main.Show();103       this.Hide();104     }

金榜排行

KTV点歌系统

 

 1  public FrmMain frmMain; 2     DBHelp db = new DBHelp(); 3     string connectionStr = "server=.;database=MyKTV;uid=sa"; 4     private void FrmJB_Load(object sender, EventArgs e) 5     { 6       SqlConnection con = new SqlConnection(connectionStr); 7       con.Open(); 8       db.connection(); 9       string sql = "SELECT song_name,song_play_count FROM dbo.song_info ORDER BY song_play_count DESC";10       string sqlsongpath = "select resource_path from resource_path where resource_id=2";11       SqlCommand cmd = new SqlCommand(sqlsongpath, con);12       KtvUnit.SongPath = cmd.ExecuteScalar().ToString();13       DataSet ds = db.dataSet(sql,"Count");14       this.dgvSongList.DataSource = ds.Tables["Count"].DefaultView;15     }16 17 18 19     private void dgvSongList_Click(object sender, EventArgs e)20     {21       DBHelp db = new DBHelp();22       if (dgvSongList.SelectedRows[0]!=null)23       {24         string songname = this.dgvSongList.SelectedRows[0].Cells["SongName"].Value.ToString();25         db.connection();26         string sql = string.Format("SELECT song_name,singer_name,song_url,song_photo_url FROM dbo.song_info,dbo.singer_info where dbo.singer_info.singer_id=dbo.song_info.singer_id and song_name='{0}'", songname);27 28         SqlDataReader reader = db.ExecuteReaders(sql.ToString());29 30         Song song;31         if (reader.Read())32         {33           song = new Song();34           song.SongName = reader["song_name"].ToString();35           song.SongURL = KtvUnit.SongPath + reader["song_url"].ToString();36           PlayList.AddSong(song);37         }38         reader.Close();39       }40       else41       {42         MessageBox.Show("空");43       }44       45     }

数字点歌

 1 public FrmMain frmMain; 2     string connectionStr = "server=.;database=MyKTV;uid=sa"; 3     DBHelp db = new DBHelp(); 4     private SqlConnection con; 5     private void FrmNumber_Load(object sender, EventArgs e) 6     { 7       con = new SqlConnection(connectionStr); 8       con.Open(); 9       string sqlsongpath = "select resource_path from resource_path where resource_id=2";10       SqlCommand cmd = new SqlCommand(sqlsongpath, con);11       KtvUnit.SongPath = cmd.ExecuteScalar().ToString();12       con.Close();13       for (int i = 1; i <= 4; i++)14       {15         for (int j = 1; j <= 3; j++)16         {17           Label label = new Label();18           label.ForeColor = Color.Red;19           label.BackColor = Color.Pink;20           label.Font=new System.Drawing.Font("华文彩云",20);21           label.TextAlign = ContentAlignment.MiddleCenter;22           label.Click += label_Click;23           this.MouseMove += FrmNumber_MouseMove;24           label.MouseHover += label_MouseHover;25           label.Size = new System.Drawing.Size(80, 40);26           label.Text = j.ToString();27           if (i > 1)28           {29             label.Text = (j + i + 1).ToString();30           }31           if (i > 2)32           {33             label.Text = (j + i + 3).ToString();34           }35           if (i > 3)36           {37             label.Text = (j + i + 5).ToString();38           }                 39           label.Location = new Point(40 + 120 * j, 40 + 60 * i);40           this.Controls.Add(label);41         }42       }43     }

已点列表

KTV点歌系统

 

 1  private void FrmPlayList_Load(object sender, EventArgs e) 2     { 3       SongList(); 4     } 5     6     public void SongList()  7     { 8       lvSong.Items.Clear(); 9       for (int i = 0; i < PlayList.SongList.Length; i++)10       {11         if (PlayList.SongList[i]!=null)12         {13           ListViewItem item = new ListViewItem();14           item.Text = PlayList.SongList[i].SongName;15           item.Tag = i;16           string playstate = PlayList.SongList[i].PlayState == SongPlayState.unplayed ? "未播放" : "已播";17           item.SubItems.Add(playstate);18           lvSong.Items.Add(item);19         }20       }21     }22 23     private void btnClose_Click(object sender, EventArgs e)24     {25       this.Close();26     }

 




原标题:KTV点歌系统

关键词:

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流