using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Threading;
namespace WindowsApplication2

{
public delegate void CloseFunction();
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
this.progressBar1.Maximum = 100;
this.thisTimer = new System.Windows.Forms.Timer();
this.thisTimer.Interval = 1000;
this.thisTimer.Tick += new EventHandler(thisTimer_Tick);
this.thisTimer.Start();
Thread thd = new Thread(new ParameterizedThreadStart(GetData ));
thd.Start();
}
void thisTimer_Tick(object sender, EventArgs e)
{
progressBar1.PerformStep();
}
private void GetData( object o )
{
Thread.Sleep(100);
thisTimer.Stop();
this.Invoke( new CloseFunction( this.Close ) );
}
private System.Windows.Forms.Timer thisTimer;
}
}
![]()
Code
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WindowsApplication2


{
public partial class MainFrame : Form

{
public MainFrame()

{
Form1 form1 = new Form1();
form1.ShowDialog();

InitializeComponent();
}

private void MainFrame_Load(object sender, EventArgs e)

{
string mPath=Application.StartupPath;
axWindowsMediaPlayer1.URL = mPath + "\\Voice\\1.mp3";
axWindowsMediaPlayer1.Ctlcontrols.play();

}
}
}
浙公网安备 33010602011771号