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."); } } }
public Form1() { InitializeComponent(); m_TwainManager = new TwainManager(m_StrProductKey); m_ImageCore = new ImageCore(); dsViewer1.Bind(m_ImageCore); this.txtboxServer.Text = m_strServerName; this.txtboxPort.Text = m_strPort; this.txtboxActionPage.Text = m_strActionPage; this.txtboxFileName.Text = "DNT_Image"; this.rdbtnJPEG.Checked = true; this.chkboxMultiPage.Enabled = false; int lngNum; m_TwainManager.OpenSourceManager(); for (lngNum = 0; lngNum < m_TwainManager.SourceCount; lngNum++) { cmbSource.Items.Add(m_TwainManager.SourceNameItems(Convert.ToInt16(lngNum))); // display the available imaging devices } if (lngNum > 0) { cmbSource.SelectedIndex = 0; } }
public Form1() { InitializeComponent(); m_TwainManager = new TwainManager(m_StrProductKey); m_ImageCore = new ImageCore(); dsViewer1.Bind(m_ImageCore); if (m_TwainManager.SourceCount > 0) { for (short i = 0; i < m_TwainManager.SourceCount; i++) { string strSourceName = m_TwainManager.SourceNameItems(i); if (strSourceName != null) { cbxSources.Items.Add(strSourceName); } } cbxSources.SelectedIndexChanged += cbxSources_SelectedIndexChanged; cbxSources.SelectedIndex = 0; } else { MessageBox.Show(this, "There is no scanner detected!\n " + "Please ensure that at least one (virtual) scanner is installed.", "Information"); return; } }
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; }
public bool SelectSource() { bool bRet = false; Console.WriteLine("Select a scanner:"); short sSourceCount = m_TwainManager.SourceCount; for (short sIndex = 0; sIndex < sSourceCount; sIndex++) { Console.WriteLine(sIndex.ToString() + ". " + m_TwainManager.SourceNameItems(sIndex)); } Console.WriteLine("Enter the scanner index:"); string temp = Console.ReadLine(); int res = Int32.Parse(temp); if (res > -1 && res < m_TwainManager.SourceCount) { bRet = m_TwainManager.SelectSourceByIndex((short)res); Console.WriteLine("Current Source name: " + m_TwainManager.CurrentSourceName); } if (!bRet) { Console.WriteLine("Fail to select source."); } return(bRet); }
private void btnSelectSource_Click(object sender, System.EventArgs e) { List <string> tempList = new List <string>(); for (int i = 0; i < m_TwainManager.SourceCount; i++) { tempList.Add(m_TwainManager.SourceNameItems((short)i)); } SourceListForm temp = new SourceListForm(tempList); temp.ShowDialog(); int iSelectSource = temp.GetSelectedIndex(); m_TwainManager.SelectSourceByIndex((short)iSelectSource); }
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); } }