要播放声音,可以这样:
using System.Runtime.InteropServices;[DllImport("winmm.dll")]
public static extern long PlaySound(String fileName,long a,long b);在点击按钮的事件中添加:
PlaySound("aaa.wav",0,0);//播放声音当你按特定键时候,在相应的事件中调用一下相应的声音文件就可以了。
using System.Runtime.InteropServices;[DllImport("winmm.dll")]
public static extern long PlaySound(String fileName,long a,long b);在点击按钮的事件中添加:
PlaySound("aaa.wav",0,0);//播放声音当你按特定键时候,在相应的事件中调用一下相应的声音文件就可以了。
解决方案 »
- 使用DES加密算法,VB6.0与C#的密文不一致
- ---下面这个是什么语法?
- tcpip通信,线程同步的问题
- SNMP 读取路由器流量数据
- csc.exe可否编译将cs文件编译成在WinCE环境下运行的exe文件
- gridView 列过多的问题?
- 附件打开问题,在线等。
- 请教大家一个禁止改变窗体大小的问题,问题比较菜,请多指教
- 求助,VS2003中原来还好好的,现在用光标移到代码上却没有提示了,调试时在光标处也没有提示,而且Watch中的变量值改变时也不再用红色显
- 求助!【请教问题】C# 实现自动登陆支付宝
- 界面问题:大家有没有遇到,前后层的的问题?---在线等。
- 请问怎样在remoting中传输Image 对象?
通过程序调用,不难的问题
你可以做个类似的程序,用playsound()来播放声音文件
能不能把你用C#开发的语音卡拿出来给大家看看啊,我发分啊.
请高手多多指教。
我们的目标是:共同进步!
//-------------------------------------------
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Runtime.InteropServices;
namespace yuying
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.ComponentModel.IContainer components; public Form1()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent(); //
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
} /// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
} #region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.button1 = new System.Windows.Forms.Button();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// button1
//
this.button1.BackColor = System.Drawing.SystemColors.Desktop;
this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.button1.ForeColor = System.Drawing.SystemColors.Info;
this.button1.Location = new System.Drawing.Point(280, 240);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(72, 24);
this.button1.TabIndex = 0;
this.button1.Text = "初始化";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// timer1
//
this.timer1.Interval = 10;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// button2
//
this.button2.BackColor = System.Drawing.SystemColors.Desktop;
this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.button2.ForeColor = System.Drawing.SystemColors.Info;
this.button2.Location = new System.Drawing.Point(8, 240);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(72, 24);
this.button2.TabIndex = 1;
this.button2.Text = "退出";
this.button2.Click += new System.EventHandler
当然,你还要做一点点代码~~~