我从一位同事那里接手了一个设计不佳的项目,并希望直接从刚刚完成的 WIA 命令加载一个图片框,以便从连接的 USB 相机拍照。
当前的实现一直等到文件被写入磁盘,然后从那里显示它,可能从磁盘重新读取文件。
Item item = d.ExecuteCommand(WIA.CommandID.wiaCommandTakePicture);
WIA.ImageFile imagefile = item.Transfer(FormatID.wiaFormatJPEG) as WIA.ImageFile;
我尝试将图像投射到给定的图片框但没有成功
picBox.Image = (Image)imageFile;