龙盟编程博客 | 无障碍搜索 | 云盘搜索神器
快速搜索
主页 > 软件开发 > VB开发 >

在VB6中实现Kodak控件编程(4)

时间:2009-12-30 15:42来源:未知 作者:admin 点击:
分享到:
2) ImgScan 的主要方法: OpenScanner :打开扫描仪; CloseScanner :关闭扫描仪; StartScan : 开始扫描; StopScan : 停止扫描 3) ImgScan使用举例 下面的程序段说明

   2) ImgScan 的主要方法:

   OpenScanner :打开扫描仪;

   CloseScanner :关闭扫描仪;

   StartScan : 开始扫描;

   StopScan : 停止扫描

   3) ImgScan使用举例

   下面的程序段说明了如何使用Kodak图像扫描控件扫描一份文档,并把它保存在函数参数指定的文件名中。注意,窗体中Kodak图像扫描控件命名为ImgScan1。

Private Function ScanTheImage(ByVal TheImageFile As String) As Boolean

  Dim ReturnValue As Long
  Dim TestString As String
  If ImgScan1.ScannerAvailable then
   ReturnValue = ImgScan1.OpenScanner()
   ImgScan1.PageOption = 2
   ImgScan1.FileType = 1
   ImgScan1.PageType = 1
   ImgScan1.CompressionType = 4
   ImgScan1.CompressionInfo = 1
   ImgScan1.ScanTo = 2 ‘保存为文件
   ImgScan1.image = TheImageFile ‘图像将被保存
   ImgScan1.ShowSetupBeforeScan = True
   ImgScan1.MultiPage = True
   ReturnValue = ImgScan1.StartScan()
   DoEvents
   ImgScan1.CloseScanner
   TestString = Dir(TheImageFile)
   If TestString <> "" Then
    ScanTheImage = True
   End If
  Else
   Msgbox “扫描设备尚不可用”
   Exit function
  End If
End Function 

三、联合应用举例

   本文附加了eiStream公司的Windows映像程序控件开发参考例程中的“Imaging Sample”一例(此程序在Windows 98/VB6下调试通过)。本例程对除了ImgOCR外四个自由控件的主要功能作了详细讨论。详见源程序” Imaging Sample.rar”。

四、小结

   以上四个Kodak控件主要威力在于:图像注释功能、多页图像文件的的管理能力、缩略图预览功能、图像扫描功能。对于专业版本,还有图像OCR功能。以上仅为抛砖引玉,读者可以结合Windows的HELP文件夹下的帮助文件Imgocxd.hlp等有关资料详细研究。

精彩图集

赞助商链接