日期:2014-05-17 浏览次数:21254 次
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.Runtime.InteropServices; //播放WAV用
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
//播放WAV用
[DllImport("winmm")]
public static extern bool PlaySound(string szSound, IntPtr hMod, int flags);
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
//点击richTextBox控件中的“http://w--212.wav”便播放“212.wav”
richTextBox1.AppendText("http://w--212.wav");
}
private void richTextBox1_LinkClicked(object sender, LinkClickedEventArgs e) //打开richTextBox中的链接
{
string file = Application.StartupPath + "\\" + e.LinkText.Substring(10);
PlaySound(file, IntPtr.Zero, 0x00020000
------其他解决方案--------------------
0x0001);
}
}
}