コード例 #1
0
        private void btnSetCapability_Click(object sender, EventArgs e)
        {
            List <string> tempList = new List <string>();

            for (int i = 0; i <= m_TwainManager.SourceCount - 1; i++)
            {
                tempList.Add(m_TwainManager.SourceNameItems(Convert.ToInt16(i)));
            }
            SourceListWrapper tempSourceListWrapper = new SourceListWrapper(tempList);
            int iSelectIndex = tempSourceListWrapper.SelectSource();

            if (iSelectIndex == -1)
            {
                return;
            }
            else
            {
                m_TwainManager.SelectSourceByIndex(iSelectIndex);
                m_TwainManager.OpenSource();

                m_TwainManager.Capability = (Dynamsoft.TWAIN.Enums.TWCapability) 0x8001;
                m_TwainManager.CapType    = Dynamsoft.TWAIN.Enums.TWCapType.TWON_ONEVALUE;
                m_TwainManager.CapValue   = 1;
                bool   bRet     = m_TwainManager.CapSet();
                double dblValue = m_TwainManager.CapValue;
                if (bRet)
                {
                    MessageBox.Show("Successful.");
                }
                else
                {
                    MessageBox.Show("Failed.");
                }
            }
        }