private void btnLigarCamera_Click(object sender, EventArgs e) { CamContainer = new DirectX.Capture.Filters(); try { int no_of_cam = CamContainer.VideoInputDevices.Count; for (int i = 0; i < no_of_cam; i++) { try { // obtém o dispositivo de entrada do vídeo Camera = CamContainer.VideoInputDevices[i]; // inicializa a Captura usando o dispositivo CaptureInfo = new DirectX.Capture.Capture(Camera, null); // Define a janela de visualização do vídeo CaptureInfo.PreviewWindow = pcCamera; // Capturando o tratamento de evento CaptureInfo.FrameCaptureComplete += AtualizaImagem; // Captura o frame do dispositivo CaptureInfo.CaptureFrame(); // Se o dispositivo foi encontrado e inicializado então sai sem checar o resto break; } catch (Exception ex) { throw ex; } } } catch (Exception ex) { MessageBox.Show(this, ex.Message); } }
private void button1_Click(object sender, EventArgs e) { try { try { CaptureInfo.CaptureFrame(); } catch (Exception ex) { MessageBox.Show(this, ex.Message); } } catch { } }
private void Form3_Load(object sender, EventArgs e) { CamContainer = new DirectX.Capture.Filters(); try { int no_of_cam = CamContainer.VideoInputDevices.Count; for (int i = 0; i < no_of_cam; i++) { try { // get the video input device Camera = CamContainer.VideoInputDevices[i]; // initialize the Capture using the video input device CaptureInfo = new DirectX.Capture.Capture(Camera, null); // set the input video preview window CaptureInfo.PreviewWindow = this.pictureBox1; // Capturing complete event handler CaptureInfo.FrameCaptureComplete += RefreshImage; // Capture the frame from input device CaptureInfo.CaptureFrame(); // if device found and initialize properly then exit without // checking rest of input device break; } catch (Exception ex) { } } } catch (Exception ex) { MessageBox.Show(this, ex.Message); } }
private void button1_Click(object sender, EventArgs e) { CaptureInfo.CaptureFrame(); tabControl1.SelectTab(tabPage2); }