public PlayerForm(string path) { InitializeComponent(); rect = new Rectangle(new Point(0, 0), Screen.PrimaryScreen.Bounds.Size); this.p = new MCIPlayer(path, "bg", this.Handle, rect); p = this.p; }
void SelectFileButtonClick(object sender, EventArgs e) { openFileDialog.ShowDialog(); player = new MCIPlayer(openFileDialog.FileName); // progress bar posTrackBar.Minimum = 0; posTrackBar.Maximum = player.GetTotalLength(); }
private void button2_Click(object sender, EventArgs e) { OpenFileDialog fileDialog = new OpenFileDialog(); fileDialog.Filter = "视频文件 (*.wmv;*.mp4)|*.wmv;*.mp4"; DialogResult res = fileDialog.ShowDialog(); if (res == System.Windows.Forms.DialogResult.OK) { string filePath = fileDialog.FileName; this.Text = "WinWallpaper [" + filePath + "]"; if (player != null) { player.Post(MCIPlayer.Cmd.close); player = null; } player = new MCIPlayer(filePath, "pre", pictureBox1.Handle, pictureBox1.DisplayRectangle); player.Post(MCIPlayer.Cmd.play); } }