/// <summary> /// 普通摄像头 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CommVideo_Click(object sender, EventArgs e) { if (IsVideoChange(typeof(UCHikVideo))) { UCHikVideo hikVideo = new UCHikVideo(SubID); hikVideo.Dock = DockStyle.Fill; this.pnlVideo.Controls.Add(hikVideo); CurVideo = hikVideo; } }
private void frmVideo_FormClosing(object sender, FormClosingEventArgs e) { if (this.pnlVideo.Controls.Count > 0) { Control ctrl = this.pnlVideo.Controls[0]; UCBaseVideo oldVideo = ctrl as UCBaseVideo; oldVideo.CloseAllVideo(true); this.pnlVideo.Controls.Remove(ctrl); ctrl = null; } }
private bool IsVideoChange(Type videotype) { bool isChangle = false; if (this.pnlVideo.Controls.Count > 0) { Control ctrl = this.pnlVideo.Controls[0]; if (ctrl.GetType() != videotype) { UCBaseVideo oldVideo = ctrl as UCBaseVideo; oldVideo.CloseAllVideo(true); this.pnlVideo.Controls.Remove(ctrl); ctrl = null; isChangle = true; } } else { isChangle = true; } return(isChangle); }