![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![ExpandedBlockStart.gif](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
//
图片拍摄
private void button2_Click( object sender, EventArgs e)
{
try
{
CameraCaptureDialog camDialog = new CameraCaptureDialog();
try
{
camDialog.InitialDirectory = @" \My Documents\我的图片 " ;
}
catch
{
camDialog.InitialDirectory = @" \My Documents " ;
}
camDialog.Mode = CameraCaptureMode.Still;
camDialog.Title = " Camera Picture " ;
// 设置图片名称
Random rd = new Random();
camDialog.DefaultFileName = " SurLog " + rd.Next( 500 ).ToString() + " .jpg " ;
camDialog.Resolution = new Size( Screen.PrimaryScreen.Bounds.Width,Screen.PrimaryScreen.Bounds.Height);
camDialog.StillQuality = CameraCaptureStillQuality.High;
camDialog.ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show( " 错误 " + ex);
}
}
private void button2_Click( object sender, EventArgs e)
{
try
{
CameraCaptureDialog camDialog = new CameraCaptureDialog();
try
{
camDialog.InitialDirectory = @" \My Documents\我的图片 " ;
}
catch
{
camDialog.InitialDirectory = @" \My Documents " ;
}
camDialog.Mode = CameraCaptureMode.Still;
camDialog.Title = " Camera Picture " ;
// 设置图片名称
Random rd = new Random();
camDialog.DefaultFileName = " SurLog " + rd.Next( 500 ).ToString() + " .jpg " ;
camDialog.Resolution = new Size( Screen.PrimaryScreen.Bounds.Width,Screen.PrimaryScreen.Bounds.Height);
camDialog.StillQuality = CameraCaptureStillQuality.High;
camDialog.ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show( " 错误 " + ex);
}
}
1.图片路径设置时 设置中文路径可能会出错
2. camDialog.Resolution 时 设置的分辨率要根据不同的手机来设置 Screen.PrimaryScreen.Bounds.Width和Height 方便
代码在模拟器上运行是可以的
--------
使用实体机运行时 camDialog.ShowDialog();出错 错误:OEMCameraDll param error 和 system.argumentexception
问题查找中
实体机报错原因:查找原因为sdk版本问题,开发使用的是wm sdk6.0 而现在的3g手机使用的sdk是6.5的
解决方法 使用Windows Mobile 6.5.3 DTK