/// <summary> /// 屏幕捕捉按钮事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_capture_Click(object sender, EventArgs e) { Form form = Application.OpenForms["CaptureForm"]; if (form == null) { captureForm = new CaptureForm(); captureForm.Show(); thread = new Thread(CaptureFrame); thread.Start(); btn_capture.Text = "停止窗口捕捉"; } else { thread.Abort(); form.Close(); btn_capture.Text = "开始窗口捕捉"; } }
/// <summary> /// 断开连接调用 /// </summary> private void disconnected() { pl_conn.Enabled = true; pl_main.Enabled = false; if (captureForm != null) { captureForm.Close(); captureForm = null; } if (thread != null && thread.IsAlive) { thread.Abort(); } writer = null; usbcmd = null; btn_connect.Text = "连接设备"; btn_capture.Text = "开始窗口捕捉"; if (inUsingDevce != null) { inUsingDevce.Close(); inUsingDevce = null; } }