请教版主,我想在扫描时实现如下功能,边扫描可以边预览,扫描仪滚轴到头后,图像就可以出来,然后扫描仪滚轴返回后,扫描结束,图像保存。
以下代码只能在扫描结束后才显示出图像:
private void _twain_AcquirePage(object sender, TwainAcquirePageEventArgs e)
{
try
{
if (e.Image != null)
{
image = e.Image;
imageViewer1.Image = image;
imageViewer1.Zoom(ControlSizeMode.Fit, 1, imageViewer1.DefaultZoomOrigin);
imageViewer1.BringToFront();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString(), "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
扫描按钮代码
// Add the Acquire page event.
_twainSession.AcquirePage += new EventHandler<TwainAcquirePageEventArgs>(_twain_AcquirePage);
// Acquire pages
_twainSession.Acquire(TwainUserInterfaceFlags.None);//None Show
// Remove the Acquire page event.
_twainSession.AcquirePage -= new EventHandler<TwainAcquirePageEventArgs>(_twain_AcquirePage);
有的扫描预览能够实现扫描四分之一就显示,显示四次可以全显示出来,不知道是怎么开发的?比如:
非常感谢版主的答复,谢谢!!!
|