首页 新闻 搜索 专区 学院

C#中使用WIA获取扫描仪文档送纸机方式的多个图片

1
悬赏园豆:10 [已关闭问题] 关闭于 2015-08-03 09:49
DeviceManager manager = new DeviceManagerClass();
Device device = null;
foreach (DeviceInfo info in manager.DeviceInfos)
{
if (info.Type != WiaDeviceType.ScannerDeviceType) continue;
device = info.Connect();
break;
}

CommonDialogClass cdc = new WIA.CommonDialogClass();
Items items = cdc.ShowSelectItems(device, WiaImageIntent.UnspecifiedIntent, WiaImageBias.MaximizeQuality, false, true, false);
MessageBox.Show(items.Count.ToString());

foreach (Item item in items)
{

CommonDialogClass cdcTemp = new WIA.CommonDialogClass();
ImageFile imageFile = cdcTemp.ShowTransfer(item,
"{B96B3CAB-0728-11D3-9D7B-0000F81EF32E}",
true) as ImageFile;
if (imageFile != null)
{
var buffer = imageFile.FileData.get_BinaryData() as byte[];
using (MemoryStream ms = new MemoryStream())
{
ms.Write(buffer, 0, buffer.Length);
pictureBox1.Image = Image.FromStream(ms);
pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
}
}

}

这样写可以得到第一张,后面的得不到,有没有做过的,看看

问题补充:

HongMaJu的主页 HongMaJu | 菜鸟二级 | 园豆:208
提问于:2015-07-23 13:38
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册