private void videoCtrl(PictureBox PlayScreen, Label lblVideo, string screan) { string mciCommand; string alias = "MyAVI"; if (lblVideo.Tag == null || lblVideo.Tag.ToString() != "正在播放") { lblVideo.Hide(); mciCommand = string.Format("open {0}\\video\\video.wmv alias {1} ", Environment.CurrentDirectory, alias); mciCommand = mciCommand + " parent " + PlayScreen.Handle.ToInt32() + " style child "; LibWrap.mciSendString(mciCommand, null, 0, 0); Rectangle r = PlayScreen.ClientRectangle; mciCommand = string.Format(" put {0} window at 0 0 {1} {2}", alias, r.Width, r.Height); LibWrap.mciSendString(mciCommand, null, 0, 0); LibWrap.mciSendString(string.Format(" play {0} repeat", alias), null, 0, 0); lblVideo.Tag = "正在播放"; } else { LibWrap.mciSendString(string.Format("close {0}", alias), null, 0, 0); lblVideo.Show(); lblVideo.Tag = "停止播放"; } }
void panel25_DoubleClick(object sender, EventArgs e) { if (!mFull) { this.panel22.Controls.Remove(this.pboxVideo2); pictureBox5.BringToFront(); pictureBox5.Controls.Add(pboxVideo2); pictureBox5.Visible = true; string mciCommand = string.Format(" put {0} window at 0 0 {1} {2}", "MyAVI", pictureBox5.Width, pictureBox5.Height - 60); LibWrap.mciSendString(mciCommand, null, 0, 0); } else { this.pictureBox5.Controls.Remove(this.pboxVideo2); pictureBox5.Visible = false; panel22.Controls.Add(pboxVideo2); string mciCommand = string.Format(" put {0} window at 0 0 {1} {2}", "MyAVI", pboxVideo2.Width, pboxVideo2.Height); LibWrap.mciSendString(mciCommand, null, 0, 0); } mFull = !mFull; }
public void setAudioOn() { string alias = "MyAVI"; LibWrap.mciSendString(string.Format(" setaudio {0} on ", alias), null, 0, 0); }
public void pause() { string alias = "MyAVI"; LibWrap.mciSendString(string.Format(" pause {0} ", alias), null, 0, 0); }