Implement Kodak control programming in VB6

Source: Internet
Author: User
1. Introduction to the Kodak Control

Image kodakimg. EXE is an attachment program used for image scanning, browsing, and editing in Windows 95/98/NT and Windows 2000 (optional during Windows installation ), free Edition and Professional Edition (additional purchase required ). During Windows installation, four OCX Kodak controls (Kodak image editing control, Kodak image management control, Kodak image scanning control, and Kodak Image Thumbnail Control) with the installation of the Free Edition image program, it is also installed together. These four controls are allowed to be used in any windows development tool to develop image-related software products. Of course, the Free Edition of the image program limits and hides some attributes and methods of the four controls. For example, the despeckle method of the Edit Control is only used in conjunction with the Professional Edition of the image program. It is also worth mentioning that the Professional Edition of the Image Program provides extended image processing capabilities by introducing new image OCR controls. In addition, the Windows Image Program is not distributed along with Windows ME and Windows XP. In the new system, Microsoft wants to replace it with "image and telex browsing program" and "scanner and camera wizard. To use the Windows Image Program on the new system, you must purchase a professional version of the Windows Image Program. However, if you upgrade from Windows 2000 to XP, there are still images and four controls available.

1. Kodak Image Management Control (non-visualized)

This control provides the following functions to manage image files:

1) Create and delete directories;

2) create and delete image files;

3) Open, save, and print image documents;

4) add, insert, and replace images in image files containing multiple images (such as TIFF;

5) Manage the attributes of image files;

2. Kodak image editing control (Visualization Mode)

The Kodak image editing control allows you to display, annotate, and manipulate images. In addition, this annotation function is provided within the OCX control. This control supports the following file formats: AWD, GIF, Tiff, BMP, JPG, wiff, dcx, PCX, and xif.

Note: AWD format cannot be used in Windows NT 4.0. GIF and wiff can only be used in Windows 98.

Image comments

The Kodak image editing control provides the image annotation function, which is implemented through several attributes, methods, and events. The annotation function allows an application to add comments to the currently displayed image. Annotation types include straight line, freehand line, hollow rectangle, filled rectangle, image embedded, image reference, text, text stamp, text from file and attack-a-note.

The image annotation function can be controlled by programming, or a standard image annotation toolbar can be activated without a single sentence of programming.

Image Manipulation

The image editing control provides many attributes, methods, and events for developers to manipulate images. Unfortunately, most of them can only be used in the Professional Edition. The Free Edition provides basic functions such as rotation, reversal, and clipboard operations.

3. Kodak image scanning control (non-visualized)

The Kodak image scanning control provides the twain interface to scan documents and communicate with any scanner and digital camera that complies with the twain protocol. This control provides the following functions:

1) applications can scan and save image documents;

2) scan one or more image documents;

3) You can add or insert multiple images in an existing document.

4. Kodak Image Thumbnail Control (Visualization Mode)

This control allows you to preview thumbnails of Multi-page image files. Its typical application is to work with the Kodak Image Management Control to add, insert, or delete a page for multi-page image files.

Ii. Use the Koda control to develop software and precautions

1. Programming Using Koda image controls

In the visual basic6 development environment of Windows, you only need to include the Kodak Image Control in the project for development. Click "project"-"components" in the menu. In the component dialog box, select the Kodak Image control. Then, the four controls appear in the control toolbar. Drag or double-click these controls to the VB form.

2. Description of software development with image program pro

If some properties, methods, events, or parameters provided by the corresponding control of the Professional Edition of the Windows Image Program are used during development, the Professional version of the image program should be installed on the end user's machine. Of course, this Professional Edition is free of charge.

3. Description of software compilation and distribution

Developers can use Koda image controls to develop image software, but these four controls cannot be distributed together with the software. Since these controls are installed along with Windows 95, 98 NT and 2000, this basically limits that the developed image software can only be used on the Windows platforms where the Windows Image Program attachment is installed. In this way, the software developed with these four controls must be compiled together with the corresponding version of the Koda image control. In addition, end users must install the corresponding version of the Image Program attachment before installing the software.

Note: During packaging, do not pack the kodka image control with the application, because the Windows Image program cannot be correctly installed. Instead, end users should install the image program independently to ensure that all required controls are correctly installed and registered. If necessary, you can reinstall the attachment of the image program from the Windows installation CD.

Practice

1. Examples of Kodak image editing controls

1) The main attribute of the imgedit control is to control the resolution of the scanned image, the image width and height, and whether to allow local selection of the image. The main methods include copying and cutting the image to the clipboard, copy images from clipboard, rotate, scale, and image images, print, save, and refresh images.

Below are some examples of using this control.

'Paste the image from the clipboard

Private sub paste_click ()
If (imgedit1.isclipboarddataavailable and imgedit1.imagedisplayed) then
'Paste the image from the clipboard. The parameter is the starting coordinate of the display area of imgedit.
Imgedit1.clipboardpaste (selleft, seltop)
End if
End sub

'Image Image

Private sub flip_click ()
If imgedit1.imagedisplayed then
Imgedit1.flip 'image Image
End if
End sub

'Rotate the image

Private sub rotate_click ()
If imgedit1.imagedisplayed then
Imgedit1.rotateright rotate the image to the right
End if
End sub

'Achieve cut

Private sub rotate_click ()
Imgedit1.drawselectionrect (selleft, seltop, selwidth, selheight) 'for Local Image Selection
Imgedit1.clipboardcut (selleft, seltop, selwidth, selheight) 'cut the selected area
End sub

2) In addition, an imganntool button control bound to the imgedit control corresponds to the "annotation" toolbar in the image program. The following example shows how to operate images in the imgedit control through the "annotation" toolbar. You only need the following simple code.

Private sub form_load ()
With imgedit1
. Fitto 0' best _ fit
. Displayblancerimage 1700,220 0
. Showannotationtoolpalette 'You can then use the "annotation" toolbar to operate the current image file
End
End sub

Ii. Examples of Kodak image scanning controls

1) The main attributes of the imgscan control include:

A. filetype: file type of the image (three types of components are supported: tiff, BMP, and AWD );

B. scanto: return or set the purpose of the scanned image;

Optional values
0 (default) displays the scanned image.
1. display the scanned image and write it into a file.
2. Write the image into a file
3. Write the image into a file and display it as a template.
4. Write images to files as templates
5. scanned Fax Images

Note: If the default value is 0, it must be used with the Wang imgedit component.

C. destimagecontrol: Wang imgedit component name;

D. Zoom: scale down ratio of the image

2) Main imgscan methods:

Openscanner: Open the scanner;

Closescanner: Close the scanner;

Startscan: Start scanning;

Stopscan: Stop Scanning

3) imgscan example

The following section describes how to use the Kodak Image scan control to scan a document and save it to the file name specified by the function parameter. Note that the Kodak Image scan control in the form is named imgscan1.

Private function scantheimage (byval theimagefile as string) as Boolean

Dim returnvalue as long
Dim teststring as string
If imgscan1.scanneravailable then
Returnvalue = imgscan1.opentracing ()
Imgscan1.pageoption = 2
Imgscan1.filetype = 1
Imgscan1.pagetype = 1
Imgscan1.compressiontype = 4
Imgscan1.compressioninfo = 1
Imgscan1.scanto = 2' save as a file
Imgscan1.image = theimagefile the image will be saved
Imgscan1.showsetupbeforescan = true
Imgscan1.multipage = true
Returnvalue = imgscan1.startscan ()
Doevents
Imgscan1.closescan
Teststring = Dir (theimagefile)
If teststring <> "" then
Scantheimage = true
End if
Else
Msgbox "scanning devices are not available"
Exit Function
End if
End Function

Iii. Examples of joint applications

This document adds an example of "imaging sample" in the Windows Image Program Control Development reference routine of eistream (this program is successfully debugged under Windows 98/VB6 ). This routine describes the main functions of four free controls except imgocr. For details, see the source program "imaging sample.rar ".

Iv. Summary

The preceding four Kodak controls provide the following functions: Image annotation, multi-page image file management, thumbnail preview, and image scanning. For professional versions, the image OCR function is also available. The above is only for reference. Readers can study the Help File imgocxd. HLP in the Help folder of windows.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.