Control the scanner in Delphi

Source: Internet
Author: User

In the use of Delphi Development information Management system, often to deal with the image, which is an inevitable trend of information management system development. How to obtain the necessary image information through the scanner in Delphi? There are three basic ways to do this:

Through the image processing software, such as Photoshop, through their scanning image function, processed into a certain format of the image after the use of their own system;

Twain.DLL via Scanner interface. This interface is provided when the scanner is installed, it is actually a plugin plug-in, which controls the scanner through a series of functions;

Control the scanner through component technology.

Using the first method can reduce the complexity of programming, however, the integration of the system is not high, users are not convenient to use; the second method can control the scanner directly at the driver level, which can provide maximum flexibility and controllability in programming. The third method can make full use of Delphi visual component technology, security, flexibility, Free to use scanners. In fact, the third method is also based on the scanner interface Twain.DLL. The method discussed in this paper adopts the third kind.

Windows9x in its accessories provided "image" can be optional, the attachment is the use of OCX components to control scanners, a total of Imgedit, Imganntool, Imgscan, Imgadmin Four, there are four of these components can basically fully control the scanner. The usage in Delphi is as follows: Choose to install "image" in windows9x. (select Add/Remove Programs in the Control Panel, and then choose Install Windows, click the Attachments checkbox, and then find the image from the details button)

Start Delphi, select "Import ActiveX control" under the "Component" menu, and you can see "Wang image editing controls, Wang Image scanning control, Wang Image management control, Wang image thumbnail control" in the list. Select these four items, and then click the "Install" button, and you can see the icons of the four artifacts on the widget Panel's ActiveX tabs.

The main attributes of Imgscan: FileType: The file type of the image (this component supports three kinds: TIFF,BMP,AWD);

Scanto: Returns or sets the purpose of the scanned image;

Meaning of desirable value

0 (default) shows the scanned image.

1 Displays the scanned image and writes a file.

2 Write the image to a file

3 The image is written to the file and displayed in a template format.

4. Write the image to a file in a template way

5 scanned images of faxes

Note: If you take the default value of 0,

Must be used in conjunction with Wang Imgedit component.

Destimagecontrol:wang Imgedit component Name;

Zoom: Scaling ratio of images

Imgscan Main methods: Openscanner: Open the scanner;

Closescanner: Close the scanner;

Startscan: Start scanning;

Stopscan: Stop Scanning

The properties of Imgedit are mainly to control the resolution of scanned images, the image width is high, whether the image is allowed to be local selection, the main methods are copy, cut image to the pasting plate, copy the image from the paste plate, rotate, shrink, mirror image, print, save, refresh the image and so on.

Detailed instructions on the above four OCX components can be viewed in Delphi with their own help system.

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.