Windows 如何在使用C拍照后自动关闭CameraCaptureDialog对话框#

Windows 如何在使用C拍照后自动关闭CameraCaptureDialog对话框#,windows,mobile,camera,capture,Windows,Mobile,Camera,Capture,我正在做一项工作,在windows mobile 6.5和.net compact framework 2.0下扫描条形码并获取条形码背后的信息,使用CameraCaptureDialog类从手机摄像头捕获图片,这是我的代码: CameraCaptureDialog cameraCaptureDialog = new CameraCaptureDialog(); cameraCaptureDialog.Owner = this; cameraCap

我正在做一项工作,在windows mobile 6.5和.net compact framework 2.0下扫描条形码并获取条形码背后的信息,使用CameraCaptureDialog类从手机摄像头捕获图片,这是我的代码:

        CameraCaptureDialog cameraCaptureDialog = new CameraCaptureDialog();
        cameraCaptureDialog.Owner = this;
        cameraCaptureDialog.Title = "";
        cameraCaptureDialog.Mode = CameraCaptureMode.Still;
        cameraCaptureDialog.InitialDirectory = dir;
        cameraCaptureDialog.Resolution = new System.Drawing.Size(640, 480);
        cameraCaptureDialog.DefaultFileName = "CodeBar.jpg";

        if (cameraCaptureDialog.ShowDialog() == DialogResult.OK && cameraCaptureDialog.FileName.Length > 0)
        {
            curFileName = cameraCaptureDialog.FileName;
            cameraCaptureDialog.Dispose();
        }

        //deal with CodeBar.jpg
问题是,在我的代码运行期间,我必须按下cameraCaptureDialog上的capture按钮,然后按下back按钮返回到我的程序来处理捕获的文件,此操作需要按下2个按钮,为了方便用户,我希望cameraCaptureDialog在用户按下capture按钮后自动关闭,如何做到这一点?据我所知,当调用ShowDialog()方法时,cameraCaptureDialog将在对话框上显示的“后退”按钮之前不会返回,因此在手动关闭cameraCaptureDialog之前,我无法执行任何操作,ShowDialog()方法返回DialogResult.OK