基本信息
源码名称:KTV点歌系统源码(亲测可用)
源码大小:30.37M
文件格式:.zip
开发语言:C#
更新时间:2018-04-26
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
附加数据库后修改 app.config中的连接串密码即可用,数据库在DB目录下,是 sql server 2012 , ide建议用vs2017
实现了添加歌手/歌曲,点播功能,具体如下图:
后台管理界面相关:
需要启用 Windows Media Player 功能,否则会提示【System.Runtime.InteropServices.COMException:“没有注册类】
操作步骤:控制面板>>程序>>启用或者关闭windows 功能>>选中 媒体功能>>Windows Media Player,点击确定即可
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace KTV
{
public partial class FrmBoFang : Form
{
public FrmBoFang()
{
InitializeComponent();
}
private bool tag = false;
public static DataSet ds = new DataSet();
private void FrmBoFang_Load(object sender, EventArgs e)
{
listBox1.DisplayMember = "歌曲名称";
listBox1.ValueMember = "存放位置";
ds.Tables.Add();
ds.Tables[0].Columns.Add("存放位置");
ds.Tables[0].Columns.Add("歌曲名称");
listBox1.DataSource = ds.Tables[0];
}
public int i = 0;
private int YouXianID = -1;
private void button9_Click(object sender, EventArgs e)
{
tag = false;
if (listBox1.Items.Count < 1)
{
MessageBox.Show("请选择您要播放的歌曲!", "温馨提示", MessageBoxButtons.OK,
MessageBoxIcon.Asterisk);
return;
}
if (listBox1.SelectedValue.ToString() != "")
{
axWindowsMediaPlayer1.URL = listBox1.SelectedValue.ToString();
i = listBox1.SelectedIndex;
}
else
{
MessageBox.Show("请选择您要播放的歌曲!", "温馨提示", MessageBoxButtons.OK,
MessageBoxIcon.Asterisk);
}
}
private void btnBoFang_Click(object sender, EventArgs e)
{
if (listBox1.Items.Count < 1)
{
MessageBox.Show("请选择您要播放的歌曲!", "温馨提示", MessageBoxButtons.OK,
MessageBoxIcon.Asterisk);
return;
}
axWindowsMediaPlayer1.Ctlcontrols.play();
tag = false;
}
private void btnZanTing_Click(object sender, EventArgs e)
{
axWindowsMediaPlayer1.Ctlcontrols.pause();
}
private void btnTingZhi_Click(object sender, EventArgs e)
{
axWindowsMediaPlayer1.Ctlcontrols.stop();
tag = true;
}
private void btnUp_Click(object sender, EventArgs e)
{
if (listBox1.Items.Count < 1)
{
MessageBox.Show("请选择您要播放的歌曲!", "温馨提示", MessageBoxButtons.OK,
MessageBoxIcon.Asterisk);
return;
}
axWindowsMediaPlayer1.Ctlcontrols.previous();
listBox1.ClearSelected();
if (i == 0)
{
i = listBox1.Items.Count - 1;
}
else
{
i=i-1;
}
listBox1.SetSelected(i, true);
axWindowsMediaPlayer1.URL = ds.Tables[0].Rows[i]["存放位置"].ToString();
}
private void btnNext_Click(object sender, EventArgs e)
{
if (listBox1.Items.Count < 1)
{
MessageBox.Show("请选择您要播放的歌曲!", "温馨提示", MessageBoxButtons.OK,
MessageBoxIcon.Asterisk);
return;
}
axWindowsMediaPlayer1.Ctlcontrols.next();
listBox1.ClearSelected();
if (i == listBox1.Items.Count - 1)
{
i = 0;
}
else
{
i = i 1;
}
listBox1.SetSelected(i, true);
axWindowsMediaPlayer1.URL = ds.Tables[0].Rows[i]["存放位置"].ToString();
}
private void button8_Click(object sender, EventArgs e)
{
ds.Tables[0].Rows.RemoveAt(listBox1.SelectedIndex);
}
private void button10_Click(object sender, EventArgs e)
{
ds.Tables[0].Rows.InsertAt(ds.Tables[0].Rows[0],listBox1.SelectedIndex - 1);
ds.Tables[0].Rows.RemoveAt(listBox1.SelectedIndex 1);
}
private void button7_Click(object sender, EventArgs e)
{
FrmXuanZe FrmXuanZe1 = new FrmXuanZe();
FrmXuanZe1.Show();
}
private void FrmBoFang_Shown(object sender, EventArgs e)
{
FrmXuanZe FrmXuanZe1 = new FrmXuanZe();
FrmXuanZe1.Show();
}
private void timer1_Tick(object sender, EventArgs e)
{
if (axWindowsMediaPlayer1.playState == WMPLib.WMPPlayState.wmppsStopped && tag==false)
{
if (YouXianID == -1)
{
listBox1.ClearSelected();
if (comboBox1.Text.Trim() == "顺序播放")
{
if (i <= listBox1.Items.Count - 1)
{
i = -1;
}
i = i 1;
}
else if (comboBox1.Text.Trim() == "倒叙播放")
{
if (i <= 0)
{
i = listBox1.Items.Count;
}
i = i - 1;
}
else if (comboBox1.Text.Trim() == "随机播放")
{
System.Random r = new Random();
i=r.Next(listBox1.Items.Count);
}
listBox1.SetSelected(i, true);
axWindowsMediaPlayer1.URL = ds.Tables[0].Rows[i]["存放位置"].ToString();
}
else
{
axWindowsMediaPlayer1.URL = ds.Tables[0].Rows[YouXianID]["存放位置"].ToString();
}
}
}
private void btnQuanPing_Click(object sender, EventArgs e)
{
if (axWindowsMediaPlayer1.playState == WMPLib.WMPPlayState.wmppsPlaying)
{
axWindowsMediaPlayer1.fullScreen = true;
}
else
{
MessageBox.Show("请先播放,再点全屏!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
}
}
private void btnYouXianBoFang_Click(object sender, EventArgs e)
{
YouXianID = listBox1.SelectedIndex;
}
private void pictureBox1_Click(object sender, EventArgs e)
{
MessageBox.Show("需要硬件设备支持!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
}
private void button1_Click(object sender, EventArgs e)
{
if (MessageBox.Show("这里退出将关闭KTV点歌系统,您真的要退出吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
{
return;
}
Application.Exit();
}
private void FrmBoFang_FormClosing(object sender, FormClosingEventArgs e)
{
if (MessageBox.Show("这里退出将关闭KTV点歌系统,您真的要退出吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
{
return;
}
Application.Exit();
}
}
}