ktv点歌系统主界面java_欢迎进入MyKTV前后台点歌系统展示

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

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

1.MyKTV前台功能:

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

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

2.MyKTV后台功能:

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

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

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

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

1f86f215039c156e500ab8895280cc8b.png

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

usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Text;usingSystem.Windows.Forms;usingSystem.Data.SqlClient;namespaceMyKTVClient

{public partial classfrmMain : Form

{publicfrmMain()

{

InitializeComponent();

}//当前播放的歌曲

privateSong song;//退出系统

SqlConnection con = newSqlConnection(DBHelper.str);private void tsbtnExit_Click(objectsender, EventArgs e)

{

Application.Exit();

}private void MainForm_Load(objectsender, EventArgs e)

{

DBHelper.frm= this;//加载时,运行播放窗体//启动计时器

this.tim.Start();//歌手照片路径

string sql = "select resource_path from resource_path where resource_id=1";

SqlCommand cmd= newSqlCommand(sql, con);//歌手照片路径

con.Open();

KTVUtil.singerPhotoPath=cmd.ExecuteScalar().ToString();//歌曲路径

sql = "select resource_path from resource_path where resource_id=2";

cmd.CommandText=sql;

KTVUtil.songPath=cmd.ExecuteScalar().ToString();

con.Close();

}//已点歌曲窗体

private void tsbtnOrdered_Click(objectsender, EventArgs e)

{

frmOrderedSongList frm= newfrmOrderedSongList();

frm.Show();

}//重新播放当前歌曲

private void tsbtnAgain_Click(objectsender, EventArgs e)

{

PlayList.PlayAgain();

PlaySong();

}//切歌

private void tsbtnCut_Click(objectsender, EventArgs e)

{if (txtnextsong.Text=="")

{

MessageBox.Show("暂无已点歌曲");

}else{

PlayList.CutSong(-1);

}

}//服务

private void toolStripButton1_Click(objectsender, EventArgs e)

{

MessageBox.Show("当前无服务!");

}//播放歌曲

private voidPlaySong()

{this.song = PlayList.GetPlayingSong(); //获取当前要播放的歌曲

if (song != null)

{this.song.SetSongPlayed(); //将当前歌曲播放状态设为已播放

this.Winplaymedia.URL = KTVUtil.songPath + "\\" + this.song.SongURL; //得到当前播放歌曲的路径

string urlls = KTVUtil.singerPhotoPath +"\\"+ this.song.Singerurl;//歌手图片

lblsongname.Text = this.song.Singername;//歌手名字

try{this.pblist.Image =Image.FromFile(urlls);

}catch(Exception)

{

MessageBox.Show("暂无歌手图片"); ;

}

}

}//定时扫描歌曲列表,显示当前播放歌曲的名称

private void timer1_Tick(objectsender, EventArgs e)

{//在文本框中显示当前播放的歌曲名字

this.txtplay.Text =PlayList.PlayingSongName();this.txtnextsong.Text =PlayList.NextSongName();if (this.song == null)

{this.PlaySong();

}if (this.Winplaymedia.playState ==WMPLib.WMPPlayState.wmppsStopped)

{this.song = null; //将歌曲设为空

PlayList.MoveOn();

}//切歌

if (this.song != null && this.song.PlayState ==SongPlayState.cut)

{this.Winplaymedia.URL = "";this.song = null;

}

}//按歌手点歌

private void picSinger_Click(objectsender, EventArgs e)

{

frmOrderBySinger frm= newfrmOrderBySinger();

frm.Show();

}//拼音点歌

private void picSongName_Click(objectsender, EventArgs e)

{

frmOrderBySongName frm= newfrmOrderBySongName();

frm.Show();

}//分类点歌

private void picSongType_Click(objectsender, EventArgs e)

{

frmOrderBySongType frm= newfrmOrderBySongType();

frm.Show();

}//排行榜点歌

private void picSongList_Click(objectsender, EventArgs e)

{

frmSongList frm= newfrmSongList();string sql = "select song_id,song_name,singer_info.singer_name,song_url,singer_info.singer_photo_url from song_info inner join singer_info on song_info.singer_id=singer_info.singer_id order by song_play_count desc";

frm.Sql=sql;

frm.Onform=FanhuiForm.Main;

frm.Show();

}//字数点歌

private void picWordCount_Click(objectsender, EventArgs e)

{

frmOrderByWordCount frm= newfrmOrderByWordCount();

frm.Show();

}private void frmMain_FormClosing(objectsender, FormClosingEventArgs e)

{//关闭应用

Application.Exit();

}//点击窗体移动

private Point mouseOffset; //记录鼠标指针的坐标

private bool isMouseDown = false; //记录鼠标按键是否按下

private void pnlTop_MouseDown(objectsender, MouseEventArgs e)

{intxOffset;intyOffset;if (e.Button ==MouseButtons.Left)

{

xOffset= -e.X -SystemInformation.FrameBorderSize.Width;

yOffset= -e.Y - SystemInformation.CaptionHeight -SystemInformation.FrameBorderSize.Height;

mouseOffset= newPoint(xOffset, yOffset);

isMouseDown= true;

}

}private void pnlTop_MouseMove(objectsender, MouseEventArgs e)

{if(isMouseDown)

{

Point mousePos=Control.MousePosition;

mousePos.Offset(mouseOffset.X+ 5, mouseOffset.Y + 30);

Location=mousePos;

}

}private void pnlTop_MouseUp(objectsender, MouseEventArgs e)

{//修改鼠标状态isMouseDown的值//确保只有鼠标左键按下并移动时,才移动窗体

if (e.Button ==MouseButtons.Left)

{

isMouseDown= false;

}

}private void pnlTop_Paint(objectsender, PaintEventArgs e)

{

}

}

}

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

01.歌手类别

afe7ac551614c761455913b739e18fe4.png

02.歌手地区

aac9e0b8a9742ee7323b9b1cbc1fecfb.png

03.歌手姓名

25aae741676653b6bad195da0d348b43.png

04.代码

usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Text;usingSystem.Windows.Forms;using System.Data.SqlClient; //ADO.NET

namespaceMyKTVClient

{public partial classfrmOrderBySinger : Form

{//当前选择的歌手性别

private string singergender = "男";//当前选择的歌手类型的编号

private int singerTypeId = 0;publicfrmOrderBySinger()

{

InitializeComponent();

}//关闭当前窗体,显示主界面

private void tsbtnHome_Click(objectsender, EventArgs e)

{this.Close();

}//重新播放当前歌曲

private void tsbtnAgain_Click(objectsender, EventArgs e)

{

PlayList.PlayAgain();

}//切歌

private void tsbtnCut_Click(objectsender, EventArgs e)

{

PlayList.CutSong(-1);

}//打开已点歌曲窗体

private void tsbtnOrdered_Click(objectsender, EventArgs e)

{

frmOrderedSongList frm= newfrmOrderedSongList();

frm.Show();

}//呼叫服务

private void tsbtnService_Click(objectsender, EventArgs e)

{

MessageBox.Show("服务!");

}//处理返回按钮的事件

private void tsbtnExit_Click(objectsender, EventArgs e)

{if (this.pnlSingerList.Visible)

{this.pnlSingerType.Visible = true;this.pnlSingerList.Visible = false;

}else if (this.pnlSingerType.Visible)

{this.pnlSingerSex.Visible = true;this.pnlSingerType.Visible = false;

}else if (this.pnlSingerSex.Visible)

{this.Close();

}

}//点击歌手的信息窗体时,弹出歌曲列表

private void lvlistthree_Click(objectsender, EventArgs e)

{//读取数据库,读出该歌手的所有歌曲

SqlConnection con = newSqlConnection(DBHelper.str);

StringBuilder sb= newStringBuilder();

sb.AppendFormat("select song_id,song_name,singer_info.singer_name,song_url,singer_info.singer_photo_url from song_info,singer_info where song_info.singer_id=singer_info.singer_id and singer_name='{0}' and song_info.singer_id={1}",

lvlistthree.SelectedItems[0].Text, Convert.ToInt32(lvlistthree.SelectedItems[0].Tag));

frmSongList frm= newfrmSongList();

frm.Sql=sb.ToString();

frm.Onform= FanhuiForm.Singergender; //指定返回的窗体是按歌手点歌

frm.Show();

}//当点击歌手类别的窗体时,弹出某歌手的信息的船体

private void lvlisttwo_Click(objectsender, EventArgs e)

{//隐藏歌手类别,显示歌手列表

pnlSingerType.Visible = false;

pnlSingerList.Location=pnlSingerSex.Location;

pnlSingerList.Dock=DockStyle.Fill;

pnlSingerList.Visible= true;this.singerTypeId = Convert.ToInt32(lvlisttwo.SelectedItems[0].Tag); //保存选中的类别编号//读取数据库,读出歌手信息

SqlConnection con = newSqlConnection(DBHelper.str);

StringBuilder sql= newStringBuilder();

sql.AppendFormat("select singer_id,singer_name,singer_photo_url from singer_info where singertype_id={0} and singer_gender='{1}'",this.singerTypeId, this.singergender);try{

SqlCommand cmd= newSqlCommand(sql.ToString(), con);

con.Open();

SqlDataReader dr=cmd.ExecuteReader();int imageIndex = 0; //代表歌手头像的索引

imglistthree.Images.Clear();//循环读出歌手信息添加到窗体中显示

lvlistthree.Items.Clear();while(dr.Read())

{//将歌手头像放在ImageList控件中

string photoURL = KTVUtil.singerPhotoPath + "\\" + Convert.ToString(dr["singer_photo_url"]);

imglistthree.Images.Add(Image.FromFile(photoURL));//将歌手添加到ListView中

ListViewItem item = newListViewItem();

item.Text= Convert.ToString(dr["s

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值