コード例 #1
0
        private void btnScan_Click(object sender, EventArgs e)
        {
            //m_TwainManager.SelectSource();
            //m_TwainManager.OpenSource();
            //m_TwainManager.IfAutoFeed = true;
            //m_TwainManager.IfFeederEnabled = true;
            //m_TwainManager.IfShowUI = false;
            //m_TwainManager.AcquireImage(this as IAcquireCallback);
            //dsViewer1.Visible = true;
            List <string> tempList = new List <string>();

            for (int i = 0; i < m_TwainManager.SourceCount; i++)
            {
                tempList.Add(m_TwainManager.SourceNameItems((short)i));
            }
            SourceListWrapper tempSourceListWrapper = new SourceListWrapper(tempList);

            int iSelectIndex = tempSourceListWrapper.SelectSource();

            if (iSelectIndex == -1)
            {
                return;
            }
            m_TwainManager.SelectSourceByIndex((short)iSelectIndex);
            m_TwainManager.OpenSource();
            m_TwainManager.IfAutoFeed      = true;
            m_TwainManager.IfFeederEnabled = true;
            m_TwainManager.IfShowUI        = false;
            m_TwainManager.AcquireImage(this as IAcquireCallback);
            dsViewer1.Visible = true;
        }
コード例 #2
0
        private void lbScan_MouseDown(object sender, MouseButtonEventArgs e)
        {
            string key = "active/" + "scan_now";

            if (!Window1.icons.ContainsKey(key))
            {
                try
                {
                    Window1.icons.Add(key, new ImageBrush(new BitmapImage(new Uri(Window1.imageDirectory + key + ".png", UriKind.RelativeOrAbsolute))));
                }
                catch { }
            }
            try
            {
                lbScan.Background = Window1.icons[key];
            }
            catch { }

            if (twain != null)
            {
                if (!IsFrameworkSatisfied())
                {
                    MessageBox.Show("WPF requires .NET Framework 3.5 SP1 or above. Please upgrade your .NET Framework.", "WpfControlsDemo", MessageBoxButton.OK, MessageBoxImage.Information);
                    return;
                }
                twain.SelectSourceByIndex(cbxSources.SelectedIndex);
                twain.OpenSource();
                twain.IfDisableSourceAfterAcquire = true;
                twain.IfShowUI        = ckbShowUI.IsChecked.Value;
                twain.IfFeederEnabled = ckbADF.IsChecked.Value;
                twain.IfDuplexEnabled = ckbDuplex.IsChecked.Value;
                if (rbBW.IsChecked.Value)
                {
                    twain.PixelType = Dynamsoft.TWAIN.Enums.TWICapPixelType.TWPT_BW;
                    twain.BitDepth  = 1;
                }
                else if (rbGrey.IsChecked.Value)
                {
                    twain.PixelType = Dynamsoft.TWAIN.Enums.TWICapPixelType.TWPT_GRAY;
                    twain.BitDepth  = 8;
                }
                else if (rbColorful.IsChecked.Value)
                {
                    twain.PixelType = Dynamsoft.TWAIN.Enums.TWICapPixelType.TWPT_RGB;
                    twain.BitDepth  = 24;
                }
                twain.AcquireImage(this as IAcquireCallback);
            }
        }
コード例 #3
0
        private void AcquireImage()
        {
            try
            {
                m_TwainManager.SelectSourceByIndex(Convert.ToInt16(cmbSource.SelectedIndex));
                m_TwainManager.IfShowUI = chkboxIfShowUI.Checked;
                m_TwainManager.OpenSource();
                m_TwainManager.IfDisableSourceAfterAcquire = true;

                m_TwainManager.IfShowUI = chkboxIfShowUI.Checked;
                m_TwainManager.AcquireImage(this as IAcquireCallback);
            }
            catch (Exception exp)
            {
                this.txtboxErrMessage.AppendText(exp.Message);
                this.txtboxErrMessage.AppendText("\r\n");
            }
        }
コード例 #4
0
        private void btnScan_Click(object sender, EventArgs e)
        {
            List <string> tempList = new List <string>();

            for (int i = 0; i < m_TwainManager.SourceCount; i++)
            {
                tempList.Add(m_TwainManager.SourceNameItems((short)i));
            }
            SourceListWrapper tempSourceListWrapper = new SourceListWrapper(tempList);

            int iSelectIndex = tempSourceListWrapper.SelectSource();

            if (iSelectIndex == -1)
            {
                return;
            }
            else
            {
                m_TwainManager.IfDisableSourceAfterAcquire = true;
                m_TwainManager.IfShowUI = true;
                m_TwainManager.SelectSourceByIndex((short)iSelectIndex);
                m_TwainManager.AcquireImage(this as IAcquireCallback);
            }
        }
コード例 #5
0
 private void button2_Click(object sender, EventArgs e)
 {
     m_TwainManager.IfDisableSourceAfterAcquire = true;
     m_TwainManager.IfShowUI = true;
     m_TwainManager.AcquireImage(this as IAcquireCallback);
 }
コード例 #6
0
 public void AcquireImage()
 {
     m_TwainManager.IfDisableSourceAfterAcquire = true;
     m_TwainManager.AcquireImage(this as IAcquireCallback);
 }