在WIA消息框中添加实时计数器

时间:2019-05-13 13:56:56

标签: c# wia

我想知道是否可以在WIA类中为我的扫描程序添加实时计数器。源代码与来自GitHub(link is here)的 Jeske 之一相同。

为了进行实时计数,在while循环之前,我声明了一个变量,该变量从0开始,并随每个循环递增:示例:

public static List<Image> Scan(string scannerId, int pages, WIAScanQuality quality, WIAPageSize pageSize) {
        List<Image> images = new List<Image>();
        bool hasMorePages = true;
        int numbrPages = pages;
        int scannedCount = 0;  // here i declared the counting variable

   while (hasMorePages) { 
   // perform all the pre-scanning requirements.

  // now let the scanning begin
  try
    {
       scannedCount += 1; // increment the number

       WIA.ICommonDialog wiaCommonDialog = new WIA.CommonDialog();
       WIA.ImageFile image = (WIA.ImageFile)wiaCommonDialog.ShowTransfer(item, wiaFormatBMP, false); // Method that shows the messageBox of the scanning proceess

    }
   catch
    {
      // The rest of the code
    }
  }
}

我的问题是:是否可以在ShowTransfer()方法中添加计数变量? (或者别的地方)?我一直在检查WIA类的方法,但是显示计数器没有成功(以显示扫描的页面数量)。谁能为我提供一些技巧和窍门以实现此功能(或者甚至可以使用WIA类)?

0 个答案:

没有答案
相关问题