简单部分主要代码分享如下:
public partial class BootForm : Form //播放全屏可以通过设置windows media player空间属性
{
[DllImport("user32.dll")] //鼠标键盘控制类
static extern void BlockInput(bool Block);
[DllImport("user32.dll", EntryPoint = "ShowCursor", CharSet = CharSet.Auto)] //游标控制类
public static extern void ShowCursor(int status);
public BootForm()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
//RegisterForm RF=new RegisterForm();
axWindowsMediaPlayer1.StatusChange += new EventHandler(axWindowsMediaPlayer1_StatusChange);
}
private void axWindowsMediaPlayer1_Enter(object sender, EventArgs e)
{
//全屏设置及隐藏鼠标
this.WindowState = FormWindowState.Maximized;
axWindowsMediaPlayer1.settings.autoStart = true;
this.FormBorderStyle = FormBorderStyle.None;
axWindowsMediaPlayer1.stretchToFit = true;//非全屏状态时是否伸展到最佳大小
//获取视频源
axWindowsMediaPlayer1.URL = @"D:\WorkStation\VS2010\MultifunctionPhysiotherapyBed\MultifunctionPhysiotherapyBed\Video\AD.mpg";
axWindowsMediaPlayer1.settings.volume = 100;
ShowCursor(0); //隐藏鼠标游标,参数0,隐藏;参数1,显示
BlockInput(true); //禁用键盘鼠标
axWindowsMediaPlayer1.Ctlcontrols.play();
}
protected void axWindowsMediaPlayer1_StatusChange(object sender, EventArgs e)
{
if ((int)axWindowsMediaPlayer1.playState == 1)
{
axWindowsMediaPlayer1.Ctlcontrols.stop();
axWindowsMediaPlayer1.close();//播放结束关闭播放器
ShowCursor(1); //显示鼠标游标
BlockInput(false);//启用键盘鼠标
AdminRegisterForm ARF = new AdminRegisterForm();
ARF.Show();
this.Hide();
}
}