我在使用ES400中的CameraCaptureDialog类时遇到错误,而在第二个图像上面写着“无法找到图像”。但是相同的代码在MC35中运行良好。
Dim app_path As String Dim ccd As New CameraCaptureDialog Dim count As Integer count = TransImagelst.Images.Count Try ccd.Owner = Me ccd.DefaultFileName = "Image" & count.ToString & ".jpg" ccd.Mode = CameraCaptureMode.Still ccd.StillQuality = CameraCaptureStillQuality.Low ccd.Resolution = New Size(0, 0) ccd.Title = "Image" ccd.InitialDirectory = DataBase_Path & "\" & Region & "\Image" ccd.ShowDialog() 'add files to image directory. If Not Directory.Exists(DataBase_Path & "\" & Region & "\Image") Then Directory.CreateDirectory(DataBase_Path & "\" & Region & "\Image") If ccd.FileName String.Empty Then TransImagelst.ImageSize = New Drawing.Size(55, 55) TransImagelst.Images.Add(New Bitmap(ccd.FileName)) TransImagelstv.View = View.LargeIcon TransImagelstv.LargeImageList = TransImagelst Dim lv As New ListViewItem("Image" & TransImagelst.Images.Count - 1) TransImagelstv.Items.Add(lv) lv.ImageIndex = TransImagelst.Images.Count - 1 End If
请帮帮我。
答案 0 :(得分:1)
我遇到了同样的问题。虽然ES400充满了功能,但它不适用于Cameracapturedialog。它甚至不支持Motorla EMDK SDK中的Imaging库。这是令人困惑的。 EMDK程序员指南有一个ES400编程条目,其中指出 - 您必须使用Microsoft的DirectShow来捕获图像。我试过这种方法,但我只能得到VGA分辨率,这对我来说是垃圾。如果这对您来说已经足够,您可以查看http://alexmogurenko.com/blog/directshownetcf/。在这一点上,我对ES400非常失望。 我最后使用的是一个有点垃圾的简单解决方案,但至少它起作用(见下面的概述并祝你好运)。
using (Process proc = new Process())
{
//This will open the internal camera application.
proc.StartInfo = new System.Diagnostics.ProcessStartInfo(@"\Windows\Camera.lnk", string.Empty);
if (proc.Start() == false)
{
Messagebox.(this did not work blablabla)
return;
}
}
//The camera app has now focus, in the meantime, we wait with a new messagebox…
Messagebox.Show(“Ok,Cancel” to open picturedialog)
if (cancel)
return;
string _filename = string.Empty;
using (SelectPictureDialog _spd = new SelectPictureDialog())
{
_spd.Owner = this;
_spd.CameraAccess = false;
_spd.LockDirectory = false;
_spd.SortOrder = SortOrder.DateDescending;
_spd.Title = "Select picture from camera";
if (_spd.ShowDialog() == DialogResult.OK)
{
_filename = _spd.FileName;
}
else //No picture selected
return;
}
//Handle image..
//Delete image from folder?