Chapter 5. DataMatrix ActiveX Control Reference

Many programming environments support the use of ActiveX objects. We have tested the Morovia DataMatrix ActiveX Control with Visual Basic, Visual C++, Internet Explorer, Microsoft Word, Excel, Access and IIS programs. The object can be used as a control embedded in a VB form or a dialog, or be used at background for image creation and printing purposes. The DataMatrix ActiveX object can also be inserted into Microsoft Office documents and many other ActiveX-aware programs.

5.1. Specification

Table 5.1. DataMatrix Control Specification

Prog IDMorovia.DataMatrixControl
ClassID{16192DED-A048-4136-94C0-2BE735582AD1}
Licensedno
File nameDataMatrixCtrl.dll
InterfaceIDataMatrixCtrlObj
Interface ID{680D55CA-980E-4559-89A7-F96CA595CE6A}

5.2. Properties

Table 5.2. List of DataMatrix Control Properties

NameDescription
BackColorSpecifies the background color for the control.
ForeColorSpecifies the foreground color for the control.
ModuleWidthSpecifies the width of a module (the smallest unit in a DataMatrix barcode).
PictureReturns a snapshot of the drawing in Windows Enhanced Metafile Format (EMF).
SizeIDReturns or sets a value for size ID of the data matrix symbols generated.
TargetDPISpecifies the value of DPI when exporting the images to vector graphics.
TextSpecifies the data to encode.

Table 5.3. List of DataMatrix Control Methods

NameDescription
CopyToClipboardPlace the drawing to clipboard in EMF format.
GetActualSizeIDRetrieves the actual size of the datamatrix symbol generated.
ExportImageVectorExport image to a file in vector graphics format specified (EMF, EPS or SVG).
ExportImageRasterExport image to a file in raster graphics fromat specified (PNG or BMP).

5.3. BackColor, ForeColor Properties

Description

BackColor - returns or sets the background color of the control.

ForeColor - returns or sets the foreground color of the control.

Syntax

object.BackColor[= Color]
object.ForeColor[= Color] 

Remarks

For open systems we strongly recommend to set the background color to solid white (0xFFFFFF) and foreground color to black (0x000000). Note: barcode requires decent contrast between the foreground color and the background color in order to be readable. Always test the readability thoroughly when you select a color pair different from black and white.

5.4. ModuleWidth Property

Description

Returns or sets a value that determines the width of a single module in the data matrix symbols generated.

Syntax

object.ModuleWidth[= String] 

Remarks

The real estate unit of a DataMatrix symbol, the module, is always rectangular. This property sets the width of the rectangle. It affects the overall symbol size.

The default value for ModuleSize is 20 mils. The property can be any numbers between 1 and 100.

This property is a string, and accepts the following units: mil, himetric, mm, cm, pt and inch. For example, 0.01cm and 1mm are all valid. If no measure unit is specified, unit of mil is assumed.

5.5. Picture Property

Description

Readonly property. Returns a snapshot of the drawing in Windows Enhanced Metafile Format (EMF).

Syntax

object.Picture

Remarks

The Picture property provides a convenient method to retrieve the drawing without first saving it to disk. The picture object contains an enhanced metafile handle which can be passed to clipboard or played on a device.

The included VB6, VC++ and C# examples use this property to retrieve an EMF handle and play it on the target printer to print the barcode.

5.6. SizeID Property

Description

Gets and Sets the size ID desired.

Syntax

object.SizeID

Remarks

Use this property to pass the datamatrix size desired, and the modifier byte that specifies additional encoder parameters. See Appendix C, Size ID Parameter (updated in version 5.1) for more information.

5.7. TargetDPI Property

Specifies the resolution of the target printer, applicable during exporting vector graphics.

Syntax

object.TargetDPI = Number 

Remarks

Whe producing small sizes of barcodes, especailly on lowe resolution printers, lengths must be align to the boundary of pixels in order to retain high quality. The ActiveX control adjusts the drawing units automaticaly based on this property when exporting vector graphics images.

5.8. Text Property

Specifies the Data to be encoded into the DataMatrix symbol.

Description

Returns or sets a string for the message to be encoded.

Syntax

object.Text[= String] 

Remarks

5.9. CopyToClipboard Method

Copies the DataMatrix image into the system clipboard, in EMF format.

Syntax

obj.CopyToClipboard 

Description

Use this method to place a copy of barcode image to the clipboard, so that you can either retrieve it immediately in your application, or other applications such as Microsoft Word.

5.10. ExportImageRaster Method

Description

Exports the current drawing to a disk file, in raster image format (PNG or BMP).

Syntax

obj.ExportImageRaster(filename, pixelsPerModule, imageType)

Parameters

filename

[in] filename. A string that corresponds to the file to be written.

pixelsPerModule

[in] Number of pixels per module.

imageType

[in] Image type. The current version supports two raster image formats:

  • 0 - PNG

  • 4 - BMP

5.11. ExportImageVector Method

Description

Exports the current drawing to a disk file, in raster image format (EMF, SVG and EPS).

Syntax

obj.ExportImageVector(filename, imageType) 

Parameters

filename

[in] filename. A string that corresponds to the file to be written.

imageType

[in] Image type. The current version supports two three image formats:

  • 1 - SVG

  • 2 - EMF

  • 3 - EPS

5.12. GetActualSizeID Method

Description

Retrieves the actual value of SizeID in the DataMatrix barcodes generated.

Syntax

obj.GetActualSizeID() 

Remarks

The property SizeID returns the size ID that you set. Use this method to retrieve the size ID in the datamatrix symbol created.