使用 WIA 扫描设置属性和抽屉 ADF

问题描述

我需要使用扫描仪的 ADF。我还没有找到任何对我有用的东西。我试过这个代码(在网上找到),但没有一个设置生效。扫描仪窗口打开,但属性未设置。此外,如果代码有效,我也不知道如何设置 ADF。 我也试过这个:Scanning with C# and WIA

private void button2_Click(object sender,EventArgs e)
{
   WIA.CommonDialog _dialog = new CommonDialog();
   WIA.Device _scanner = _dialog.ShowSelectDevice(WIA.WiaDeviceType.ScannerDeviceType,false,false);

        foreach (Property item in _scanner.Items[1].Properties)
        {
            switch (item.PropertyID)
            {
                case 6146: //4 is Black-white,gray is 2,color 1
                    SetProperty(item,2);
                    break;
                case 6147: //dots per inch/horizontal 
                    SetProperty(item,100);
                    break;
                case 6148: //dots per inch/vertical 
                    SetProperty(item,100);
                    break;
                case 6149: //x point where to start scan 
                    SetProperty(item,0);
                    break;
                case 6150: //y-point where to start scan 
                    SetProperty(item,0);
                    break;
                case 6151: //horizontal exent 
                    SetProperty(item,(int)(8.5 * 100));
                    break;
                case 6152: //vertical extent 
                    SetProperty(item,11 * 100);
                    break;
            }
        }

        CommonDialog oDialog = new CommonDialog();
        oDialog.ShowAcquisitionWizard(_scanner);
   }



    private void SetProperty(Property property,int value)
    {
        IProperty x = (IProperty)property;
        Object val = value;
        x.set_Value(ref val);
    }

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)