用两个定时器来交替工作:timer1用来监控时间,如与设定时间相同,则发生触发事件,传递参数,暂停timer1使用,启用timer2工作,并且打开开关;timer2收到开关信息后,触发事件:启动timer1、关闭开关、关闭自身timer2、播音。
namespace WindowsApplication3
{
public partial class Form1 : Form
{
bool tt=false;
public Form1()
{
InitializeComponent();
}
{
public partial class Form1 : Form
{
bool tt=false;
public Form1()
{
InitializeComponent();
}
private void timer1_Tick(object sender, EventArgs e)
{
// DateTime d = new DateTime();
string s = DateTime.Now.ToString("hh:mm:ss");
string a = "10:02:30";
if(s==a)
{
timer1.Enabled = false;
tt = true;
axWindowsMediaPlayer1.URL = "E:
{
// DateTime d = new DateTime();
string s = DateTime.Now.ToString("hh:mm:ss");
string a = "10:02:30";
if(s==a)
{
timer1.Enabled = false;
tt = true;
axWindowsMediaPlayer1.URL = "E: