我正在使用网络摄像头c#(Windows应用程序)使用Direct Show dll
当我单击捕获按钮调用时:
capture.FrameEvent2 += new Capture.HeFrame(CaptureDone);
private void CaptureDone(System.Drawing.Bitmap e)
{
if (Captured == true)
{
capture.FrameEvent2 -= new Capture.HeFrame(CaptureDone); return;
}
Bitmap bitmap = null;
bitmap = e;
DateTime localDate = DateTime.Now;
string a = localDate.ToString("ddMMMyyyy");
ImageCount = ImageCount + 1;
Image old = pictureBox1.Image;
pictureBox1.Image = bitmap;
StoreImage(pictureBox1.Image);
string ImageName = "";
ImageFormat imageFormat = null;
//Please Change these to opdno
string regno = txtOpdno.Text;
string filePath = Application.StartupPath + "\\SonoImage\\" + regno + "";
if (!Directory.Exists(filePath))
{
Directory.CreateDirectory(filePath);
ImageName = Convert.ToString(ImageCount) + "-" + Convert.ToString(a);
filePath = filePath + "\\" + ImageName + ".Jpeg";
}
else
{
ImageName = Convert.ToString(ImageCount) + "-" + Convert.ToString(a);
filePath = filePath + "\\" + ImageName + ".Jpeg";
}
bitmap.Save(filePath, ImageFormat.Jpeg);
Captured = true;
}
一切正常,但突然创建了:
对象目前在其他地方使用 谁能回答我为什么会产生这种错误? 如何停止呢?