




已阅读5页,还剩15页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
MP3 类一using System;using System.Collections.Generic;using System.Text;using System.Runtime.InteropServices;namespace KJJclass API public const int WM_SYSCOMMAND = 0x112; public const int SC_MOVE = 0xF010; public const int HTCAPTION = 0x2; DllImportAttribute(user32.dll) public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam); DllImportAttribute(user32.dll) public static extern bool ReleaseCapture(); DllImport(kernel32.dll, CharSet = CharSet.Auto) public static extern int GetShortPathName(string lpszLongPath, string shortFile, int cchBuffer); DllImport(winmm.dll, EntryPoint = mciSendString, CharSet = CharSet.Auto) public static extern int mciSendString(string lpstrCommand, string lpstrReturnString, int uReturnLength, int hwndCallback);MP3 类二 class Form32 public static void OpenAndPlay(string strFileName, bool flagRepeat) string strCommand = ; string buf = ; strCommand = open + strFileName + alias music; buf = buf.PadLeft(128, ); API.mciSendString(strCommand, buf, buf.Length, 0); if (flagRepeat) strCommand = play music repeat; else strCommand = play music; API.mciSendString(strCommand, buf, buf.Length, 0); public static void Play(bool flagRepeat) string strCommand = ; if (flagRepeat) strCommand = play music repeat; else strCommand = play music; API.mciSendString(strCommand, , 0, 0); public static bool SetProcess(int nPosition) bool success = false; string strCommand = string.Format(seek music to 0, nPosition); if (API.mciSendString(strCommand, , 0, 0) = 0) success = true; return success; public static void StepN(int nStep) API.mciSendString(step music by + nStep.ToString(), , 0, 0); public static void Stop() /暂停播放 API.mciSendString(stop music, , 0, 0); public static void Pause()/暂停 API.mciSendString(pause music, , 0, 0); public static void Resume()/继续播放 API.mciSendString(resume music, , 0, 0); public static int GetCurrentPosition() /获得当前播放位置 string buf = ; buf = buf.PadLeft(128, ); API.mciSendString(status music position, buf, buf.Length, 0); buf = buf.Trim().Replace(0, ); if (string.IsNullOrEmpty(buf) return 0; else return (int)(Convert.ToDouble(buf) / 1000; public static void Forward()/快进 int x = Form32.GetCurrentPosition(); int y = 1000 * x + 2000; Form32.SetProcess(y); public static void Backward() /后退 int x = Form32.GetCurrentPosition(); int y = 1000 * x - 2000; Form32.SetProcess(y); public static bool SetVolume(int Valume) /设置音量大小 bool success = false; string strCommand = string.Format(setaudio music volume to 0, Valume); if (API.mciSendString(strCommand, , 0, 0) = 0) success = true; return success; public static int GetVolume() /获得当前音量 string strVolume = ; strVolume = strVolume.PadLeft(128, ); API.mciSendString(status music volume, strVolume, strVolume.Length, 0); int nVolume = 0; strVolume = strVolume.Trim().Replace(0, ); if (string.IsNullOrEmpty(strVolume) nVolume = 0; else nVolume = Convert.ToInt32(strVolume); return nVolume; public static void increase_voice()/加大音量 SetVolume(GetVolume() + 250); public static void decrease_voice()/减少音量 SetVolume(GetVolume() - 250); MP3总代码namespace KJJ public partial class Form3 : Form public Form3() InitializeComponent(); private void b1_Click(object sender, EventArgs e) OpenFileDialog x = new OpenFileDialog(); DialogResult y = x.ShowDialog(); if (y = DialogResult.OK) t1.Text = x.FileName; private void b2_Click(object sender, EventArgs e) Form32.OpenAndPlay(t1.Text, true); private void b3_Click(object sender, EventArgs e) if (b3.Text = 暂停) Form32.Pause(); b3.Text = 继续播放; else Form32.Resume(); b3.Text = 暂停; private void b4_Click(object sender, EventArgs e) Form32.Stop(); private void b5_Click(object sender, EventArgs e) Form32.Forward(); Form32.OpenAndPlay(t1.Text, true); private void b6_Click(object sender, EventArgs e) Form32.Backward(); Form32.OpenAndPlay(t1.Text, true); private void b7_Click(object sender, EventArgs e) Form32.increase_voice(); private void b8_Click(object sender, EventArgs e) Form32.decrease_voice(); 视频代码button1代码 DialogResult dr = openFileDialog1.ShowDialog(); if (dr = DialogResult.OK) textBox1.Text = openFileDialog1.FileName; button2代码 string strFile = textBox1.Text; axWindowsMediaPlayer1.URL = strFile; axWindowsMediaPlayer1.Ctlcontrols.play();光标测试t1_KeyDown代码 if (e.KeyValue = 13) t4.Focus(); else if (e.KeyValue = 40) t4.Focus(); else if (e.KeyValue = 39) t2.Focus(); else if (e.KeyValue = 38) t7.Focus(); else if (e.KeyValue = 37) t9.Focus(); t2_KeyDown代码 if (e.KeyValue = 13) t4.Focus(); else if (e.KeyValue = 40) t5.Focus(); else if (e.KeyValue = 39) t3.Focus(); else if (e.KeyValue = 38) t8.Focus(); else if (e.KeyValue = 37) t1.Focus(); t3_KeyDown代码 if (e.KeyValue = 13) t4.Focus(); else if (e.KeyValue = 40) t6.Focus(); else if (e.KeyValue = 39) t4.Focus(); else if (e.KeyValue = 38) t9.Focus(); else if (e.KeyValue = 37) t2.Focus(); t4_KeyDown代码 if (e.KeyValue = 13) t7.Focus(); else if (e.KeyValue = 40) t7.Focus(); else if (e.KeyValue = 39) t5.Focus(); else if (e.KeyValue = 38) t1.Focus(); else if (e.KeyValue = 37) t3.Focus(); t5_KeyDown代码 if (e.KeyValue = 13) t7.Focus(); else if (e.KeyValue = 40) t8.Focus(); else if (e.KeyValue = 39) t6.Focus(); else if (e.KeyValue = 38) t2.Focus(); else if (e.KeyValue = 37) t4.Focus(); t6_KeyDown代码 if (e.KeyValue = 13) t7.Focus(); else if (e.KeyValue = 40) t9.Focus(); else if (e.KeyValue = 39) t7.Focus(); else if (e.KeyValue = 38) t3.Focus(); else if (e.KeyValue = 37) t5.Focus(); t7_KeyDown代码 if (e.KeyValue = 13) t1.Focus(); else if (e.KeyValue = 40) t1.Focus(); else if (e.KeyValue = 39) t8.Focus(); else if (e.KeyValue = 38) t4.Focus(); else if (e.KeyValue = 37) t6.Focus(); t8_KeyDown代码 if (e.KeyValue = 13) t1.Focus(); else if (e.KeyValue = 40) t2.Focus(); else if (e.KeyValue = 39) t9.Focus(); else if (e.KeyValue = 38) t5.Focus(); else if (e.KeyValue = 37) t7.Focus(); t9_KeyDown代码 if (e.KeyValue = 13) t1.Focus(); else if (e.KeyValue = 40) t3.Focus(); else if (e.KeyValue = 39) t1.Focus(); else if (e.KeyValue = 38) t6.Focus(); else if (e.KeyValue = 37) t8.Focus(); button1_Click代码 StringBuilder str = new StringBuilder(); str.AppendFormat(第一个输入值是: + t1.Text); str.AppendFormat(n第二个输入值是: + t2.Text); str.AppendFormat(n第三个输入值是: + t3.Text); str.AppendFormat(n第四个输入值是: + t4.Text); str.AppendFormat(n第五个输入值是: + t5.Text); str.AppendFormat(n第六个输入值是: + t6.Text); str.AppendFormat(n第七个输入值是: + t7.Text); str.AppendFormat(n第八个输入值是: + t8.Text); str.AppendFormat(n第九个输入值是: + t9.Text); MessageBox.Show(str.ToString(); button2_Click代码 this.Close(); add代码using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.Data.OleDb;namespace KJJ public partial class add : Form public add() InitializeComponent(); OleDbConnection conn = new OleDbConnection(); OleDbCommand comm = new OleDbCommand(); DialogResult result; private void button1_Click(object sender, EventArgs e) StringBuilder sql = new StringBuilder(); sql.AppendFormat(insert into 学生基本信息 values(0,1,2,3,4,5,6) , t1.Text, t2.Text, comboBox1.SelectedItem.ToString(), t4.Text, t5.Text, t6.Text, t7.Text ); try conn.ConnectionString = Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Student.mdb; conn.Open(); comm.Connection = conn; comm.CommandType = CommandType.Text; comm.CommandText = sql.ToString(); int x = comm.ExecuteNonQuery(); if (x = 1) result = DialogResult.OK; this.DialogResult = result; MessageBox.Show(插入新记录成功); this.Close(); catch (Exception x) MessageBox.Show(x.Message); finally conn.Close(); update代码using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.Data.OleDb;namespace KJJ public partial class update : Form public update() InitializeComponent(); public static String data; OleDbConnection conn = new OleDbConnection(); OleDbCommand comm = new OleDbCommand(); OleDbDataAdapter adapt = new OleDbDataAdapter(); DataTable dt = new DataTable(); DataRow dr; DialogResult result; private void update_Load(object sender, EventArgs e) try conn.ConnectionString = Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Student.mdb; conn.Open(); comm.Connection = conn; comm.CommandType = CommandType.Text; comm.CommandText = select * from 学生基本信息 where 学号= + data + ; adapt.SelectCommand = comm; adapt.Fill(dt); dr = dt.Rows0; t1.Text = dr0.ToString(); t2.Text = dr1.ToString(); comboBox1.SelectedItem = dr2.ToString(); t4.Text = dr3.ToString(); t5.Text = dr4.ToString(); t6.Text = dr5.ToString(); t7.Text = dr6.ToString(); catch (Exception x) MessageBox.Show(x.Message); finally conn.Close(); private void button1_Click(object sender, EventArgs e) StringBuilder sql = new StringBuilder(); sql.AppendFormat(update 学生基本信息 set 姓名=1,性别=2,年级=3,班级=4,电话=5,年龄=6where 学号=0 , t1.Text, t2.Text, comboBox1.SelectedItem.ToString(), t4.Text, t5.Text, t6.Text, t7.Text); try conn.ConnectionString = Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Student.mdb; conn.Open(); comm.Connection = conn; comm.CommandType = CommandType.Text; comm.CommandText = sql.ToString(); int x = comm.ExecuteNonQuery(); if (x = 1) result = DialogResult.OK; this.DialogResult = result; MessageBox.Show(修改记录成功); this.Close(); catch (Exception x) MessageBox.Show(x.Message); finally conn.Close(); 数据库代码using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.Data.OleDb;namespace KJJ public partial class Form4 : Form public Form4() InitializeComponent(); OleDbCommand comm = new OleDbCommand(); OleDbConnection conn = new OleDbConnection(); OleDbDataAdapter adapt = new OleDbDataAdapter(); DataTable dt = new DataTable(); /按条件查询并更新视图 private void button1_Click(object sender, EventArgs e) select(); public void select() String temp = 1=1; if (textBox1.Text.Trim() != ) temp += and 学号= + textBox1.Text.Trim() + ; if (textBox2.Text.Trim() != ) temp += and 姓名= + textBox2.Text.Trim() + ; if (comboBox1.Text.Trim() != ) temp += and 性别= + comboBox1.Text.Trim() + ; if (textBox4.Text.Trim() != ) temp += and 年级= + textBox4.Text.Trim() + ; String sql = Select * from 学生基本信息 where + temp; try conn.ConnectionString = Provider=Microsoft.Jet.OLEDB.4.0;Data source= + Application.StartupPath + Student.mdb; conn.Open(); comm.Connection = conn; comm.CommandTy
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 安全培训效评价课件
- 2025福建厦门鼓浪湾大酒店有限公司(第二批)招聘5人模拟试卷及答案详解(夺冠)
- Hydroxyprogesterone-Caproate-d11-17α-Hydroxyprogesterone-hexanoate-d-sub-11-sub-生命科学试剂-MCE
- Human-EPO-mRNA-生命科学试剂-MCE
- HGS004-生命科学试剂-MCE
- HDAC11-IN-1-TFA-生命科学试剂-MCE
- 2025年宁波慈溪市中西医结合医疗健康集团招聘派遣制工作人员3人模拟试卷及答案详解(必刷)
- 搭建商战略合作协议范本5篇
- 金融系统安全运行承诺函8篇
- 项目工程如期保质完成承诺书(4篇)
- ISO 22000-2018食品质量管理体系-食品链中各类组织的要求(2023-雷泽佳译)
- 卡巴斯基应急响应指南
- 理财规划大赛优秀作品范例(一)
- 2023年四川能投筠连电力招聘笔试参考题库附带答案详解
- 护理管理组织结构与设计
- 静配中心清洁消毒考核试题
- 一级烟草专卖管理师理论考试题库(含答案)
- 小学数学《分数除法》50道应用题包含答案
- 碳捕集、利用与封存技术课件
- 化工试生产总结报告
- 复句与单句的辨析课件
评论
0/150
提交评论