⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.cs

📁 vs2005串口编程示例,好多例子,是学习串口编程方面不错的资料
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

using System.Data.OleDb;

namespace Ex13_19
{
    public partial class Form1 : Form
    {
        string strFileName = "";

        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (strFileName == "")
            {
                MessageBox.Show("请在列表中选择播放文件!","系统提示");
                return;
            }
            axREALmagicCtrl1.Filename = strFileName;  //指定播放文件
            axREALmagicCtrl1.Play(); //播放
        }

        private void btnPause_Click(object sender, EventArgs e)
        {
            axREALmagicCtrl1.Pause(); //暂停播放
        }

        private void btnStop_Click(object sender, EventArgs e)
        {
            axREALmagicCtrl1.Stop();  //停止播放
        }

        private void btnSpeed_Click(object sender, EventArgs e)
        {
            axREALmagicCtrl1.CurrentFrame = axREALmagicCtrl1.CurrentFrame + 125; //快进
        }

        private void btnRecede_Click(object sender, EventArgs e)
        {
                axREALmagicCtrl1.CurrentFrame = axREALmagicCtrl1.CurrentFrame - 125; //快退
        }

        private void rdoLeftTrack_Click(object sender, EventArgs e)
        {
            axREALmagicCtrl1.AudioChannel = NNSREALmagicCtrl.TAudChannel.acLEFT; //左声道
        }

        private void rdoRightTrack_Click(object sender, EventArgs e)
        {
            axREALmagicCtrl1.AudioChannel = NNSREALmagicCtrl.TAudChannel.acRIGHT; //右声道
        }

        private void rdoStereo_Click(object sender, EventArgs e)
        {
            axREALmagicCtrl1.AudioChannel = NNSREALmagicCtrl.TAudChannel.acSTEREO; //立体声
        }

        private void tbVolume_Scroll(object sender, EventArgs e)
        {
            axREALmagicCtrl1.Volume = tbVolume.Value;   //音量
        }

        private void rdoTV_Click(object sender, EventArgs e)
        {
            axREALmagicCtrl1.DisplayDevice = NNSREALmagicCtrl.TDisDev.ddTV; //TV输出模式
        }

        private void rdoVGA_Click(object sender, EventArgs e)
        {
            axREALmagicCtrl1.DisplayDevice = NNSREALmagicCtrl.TDisDev.ddVGA; //VGA输出模式
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            if (!axREALmagicCtrl1.OpenDriver())  //打开驱动
            {
                MessageBox.Show("打开驱动失败!!", "系统提示");
                this.groupBox1.Enabled = false;
                this.groupBox2.Enabled = false;
                this.groupBox3.Enabled = false;
                this.groupBox4.Enabled = false;
                return;
            }
            OleDbConnection con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + "DataBase.mdb" + ";Persist Security Info=False");
            OleDbDataAdapter dap = new OleDbDataAdapter("select G_name as 影音名称,G_YC as 原唱,G_wjlx as 文件格式 from g_music_name", con);
            DataSet ds = new DataSet();
            dap.Fill(ds); //显示影音文件的相关属性
            dataGridView1.DataSource = ds.Tables[0].DefaultView;
        }
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {  //选择播放的影音
            strFileName = @"\vod\" + dataGridView1[0, e.RowIndex].Value.ToString() + "." + dataGridView1[2, e.RowIndex].Value.ToString();
        }

        private void btnExit_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -