//停止监控 private void btnStop_Click(object sender, EventArgs e) { if (btnStop.Text == "停止") { string strDPath = Application.StartupPath; string strPath = strDPath.Substring(0, strDPath.LastIndexOf("\\")).Substring(0, strDPath.Substring(0, strDPath.LastIndexOf("\\")).LastIndexOf("\\")) + "\\Image\\主页面\\bg.bmp"; setVideoBG(strPath); VideoOperate.VCAUnInitSdk(); btnStop.Text = "开始"; } else if (btnStop.Text == "开始") { setVideoBG(""); startMonitor(); btnStop.Text = "停止"; } }
//停止监控 private void btnStop_Click(object sender, EventArgs e) { try { if (btnStop.Text == "停止") { string strDPath = Application.StartupPath; string strPath = strDPath.Substring(0, strDPath.LastIndexOf("\\")).Substring(0, strDPath.Substring(0, strDPath.LastIndexOf("\\")).LastIndexOf("\\")) + "\\Image\\主页面\\主界面图片.bmp"; plVideo1.BackgroundImage = System.Drawing.Image.FromFile(strPath); VideoOperate.VCAUnInitSdk(); btnStop.Text = "开始"; } else if (btnStop.Text == "开始") { plVideo1.BackgroundImage = null; startMonitor(); btnStop.Text = "停止"; } } catch (Exception ex) { MessageBox.Show("非法错误。" + ex.ToString()); } }