当前上下文中不存在名称“video
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace _718单个摄像头
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
btnPlay.Enabled = false;
btnStop.Enabled = true;
btnPz.Enabled = true;
video = new cVideo(pictureBox1.Handle, pictureBox1.Width, pictureBox1.Height);
video.StartWebCam();
}
//在【关闭视频】按钮的Click事件中添加如下代码:
private void b_stop_Click(object sender, EventArgs e)
{
btnPlay.Enabled = true;
btnStop.Enabled = false;
btnPz.Enabled = false;
video.CloseWebcam();
}
//在【拍摄照片】按钮的Click事件下添加如下代码:
private void btnPz_Click(object sender, EventArgs e)
{
video.GrabImage(pictureBox1.Handle, "d:\\a.bmp");
}
}
}