本帖最后由 a109101089 于 2017-8-11 16:26 编辑
在扫描仪自带界面中设置影像为“文档部分”并成功进行一次扫描后,如下图:
再调用自动纠偏的方法报错“Operation not supported by capability”,如下图:
而又重新选择“整份文档”并成功进行一次扫描后再调用自动纠偏的方法就不会报错了,请问设置“文档部分”这里是修改了哪一个属性
以下为自动纠偏的方法:
private void SetDeskew()
{
if (cbAutoDeskew.Checked)
{
MySetCapability(TwainCapabilityType.ImageAutomaticDeskew, TwainItemType.Bool, true);
}
else
{
MySetCapability(TwainCapabilityType.ImageAutomaticDeskew, TwainItemType.Bool, false);
}
}
private void MySetCapability(TwainCapabilityType capType, TwainItemType itemType, object data)
{
try
{
using (TwainCapability twnCap = new TwainCapability())
{
twnCap.Information.Type = capType;
twnCap.Information.ContainerType = TwainContainerType.OneValue;
twnCap.OneValueCapability.ItemType = itemType;
twnCap.OneValueCapability.Value = data;
_twainSession.SetCapability(twnCap, TwainSetCapabilityMode.Set);
}
}
catch (Exception ex)
{
ex.Source = capType.ToString();
throw ex;
}
}
|