BarcodeTools.com
Professional BarCode Software
Home
Barcode ActiveX
DataMatrix ActiveX
PDF417 ActiveX
MaxiCode ActiveX
QRCode ActiveX
Barcode .NET
DataMatrix .NET
PDF417 .NET
Barcode ASP.NET
DataMatrix ASP.NET
PDF417 ASP.NET
ISAPI
CGI
LabelBar(Pro)
Console Apps
Barcode Recognition
Order
FAQs
Flash Tutorials
Support
Barcode Types
OnLine Barcode
Our barcode software compatible with Windows XP, 7, 8, 10

Home arrow DataMatrix ActiveX arrow More Info arrow Methods
Methods Print E-mail

DataMatrix BarCode ActiveX Methods



AboutBox Method
Opens an About window.

Syntax
object.AboutBox()
Return Value
No return value.



ShowProperties Method
Opens a custom properties of the DataMatrix Barcode ActiveX Control.

Syntax
object.ShowProperties()
Return Value
No return value.



SaveToImageFile Method
Saves the image of the barcode to a file.

Syntax
object.SaveToImageFile(cx, cy, sFileName, [lRes,] [dm])
Parameters
cxA double that defines the barcode picture width.
cyA double that defines the barcode picture height.
sFileNameA string expression defining the file name.
lResOptional (default 0). A long value that sets the picture resolution.
dmOptional (default dmPixels). This value defines the units that should be used to specify cx and cy. See remarks.
Return Value
No return value.
Remarks
The format the file will be saved in depends on the extension of the file name For example, if you specify sFileName as "img1.jpg", the barcode will be saved as JPEG.
The following extensions can be used - "wmf", "emf", "bmp", "jpg", "jpeg", "gif", "tiff" and "png".

The dm parameter may has the following values:
dmMils = 0, mils(0.001 inches)
dmInches = 1, inches
dmMM = 2, millimeters
dmPixels = 3, pixels

If the size of an image (cx, cy) is not specified in pixels, its actual size will be calculated using the specified picture resolution - lRes.

Warning! For this method to function properly, you should have the GDI+ library (gdiplus.dll) installed on your PC, this library is distributed with Windows XP and higher. if you do not have this library, you can download it here, and copy it to the folder "../Windows/System32/".
Examples
'1.
'Save the image to a file of the JPEG format. The size of the image will be 100x100 pixels with the resolution of 96 dpi.

Call DataMatrixCtrl1.SaveToImageFile(100, 100, "c:\datamatrix.gif")

'2.
'Save the image to a file of the JPEG format. The size of the image will be 30x30 millimeters with the resolution of 300 dpi.

Call DataMatrixCtrl1.SaveToImageFile(30, 30, "c:\datamatrix.gif", 300, dmMM)



PartialWritePicture Method
Saves the barcode to an existing image file. The barcode can occupy just the part of the image file it needs.

Syntax
object.PartialWritePicture(sFileName, x, y, width, height)
Parameters
sFileNameA string expression defining the file name.
xAn integer value that defines the X coordinate of the barcode.
yAn integer value that defines the Y coordinate of the barcode.
widthAn integer that defines the barcode width.
heightAn integer that defines the barcode height.
Return Value
No return value.
Remarks
The image file defined by the sFileName parameter can be of the following formats: "bmp", "jpg", "jpeg", "gif", "tiff" and "png".
Examples
Call DataMatrix.PartialWritePicture("c:\1.jpg", 10, 10, 60, 60)

DataMatrix Barcode ActiveX saves the barcode image into the existing picture file

You can use this method to add a barcode to any of your image files. This barcode can be used to identify the file or serve other purposes.



CopyToClipboard Method
Copies the image of the barcode onto the clipboard. After that you can insert this image into your program using Ctrl+V or the Paste menu item.

Syntax
object.CopyToClipboard(cx, cy)
Parameters
cxAn integer value that defines the barcode picture width
cyAn integer value that defines the barcode picture height
Return Value
No return value.



DrawMatrixToSize Method
Draws the barcode in the device context. You can use either printer or screen as the device context.

Syntax
object.DrawMatrixToSize(X, Y, CX, CY, dm, [hDC])

Parameters

XA double value that defines the X coordinate of the barcode.
YA double value that defines the Y coordinate of the barcode.
CXA double that defines the barcode width.
CYA double that defines the barcode height.
dmOptional (default dmPixels). This value defines the units that should be used to specify cx and cy. See here.
hDCOptional (default 0). The handle of the device context where the barcode will be drawn. If this parameter is not specified or set to zero, the printer device context will be used.

Return Value

No return value.
Examples
'Draw a matrix to a screen.
Call DataMatrixCtrl1.DrawMatrixToSize(0, 0, 200, 200, dmPixels, Form1.hDC)


'Print a matrix
'Open a current printer

Call DataMatrixCtrl1.BeginPrint("")

'print a matrix to X=10 mm, Y=10 mm, WIDTH=25 mm, HEIGHT=25 mm
Call DataMatrixCtrl1.DrawMatrixToSize(10, 10, 25, 25, dmMM)

Call DataMatrixCtrl1.EndPrint



BeginPrint Method
Opens access to a printer.

Syntax
object.BeginPrint(sPrinterName)
Parameters
sPrinterNameA string value that defines the name of the printer. The name of the printer can be determined in the Printer folder of the Control Panel.
If the name is blank, the default printer will be opened.
Return Value
No return value.
Remarks
This function must be called first before other printing features are used.



EndPrint Method
Closes the printer. You cannot use any printing features after that.

Syntax
object.EndPrint()
Return Value
No return value.



NewPage Method
The StartPage function prepares the printer driver to accept data.

Syntax
object.NewPage()
Return Value
No return value.



EndPage Method
The EndPage function notifies the device that the application has finished writing to a page. This function is typically used to direct the device driver to advance to a new page.

Syntax
object.EndPage()
Return Value
No return value.



GetPrinterHDC Method
The function returns the handle of the printer previously opened with the help of the BeginPrint function.

Syntax
object.GetPrinterHDC()

Return Value
HDC



SetPrinterHDC Method
Defines the handle of the printer that will be used for printing. If this function is called, you do not have to call BeginPrint. In this case the entire process of closing/opening the printer, etc. will be controlled outside the DataMatrix ActiveX Control.

Syntax
object.SetPrinterHDC(hDC)
Parameters
hDCValue that specifies the printer handle.
Return Value
No return value.
Example
Printer.CurrentX = 2048
Printer.Print "BarcodeTools.com, VB Example"

'DataMatrix-ActiveX will use the Visual Basic Printer object
Call DataMatrixCtrl1.SetPrinterHDC(Printer.hDC)

'print the barcodes
Call DataMatrixCtrl1.DrawMatrixToSize(10, 10, 30, 30, dmMM)
Call DataMatrixCtrl1.DrawMatrixToSize(70, 10, 30, 30, dmMM)

Printer.EndDoc



BinaryWritePicture Method
This method is similar to SaveToImageFile, but instead of saving the image to a file it represents it as a byte array.

Syntax
object.BinaryWritePicture(sFmt, CX, CY)

Parameters

sFmtString that specifies the file name extension.
The following extensions can be used - "wmf", "emf", "bmp", "jpg", "jpeg", "gif", "tiff" and "png".
CXA integer that defines the barcode width
CYA integer that defines the barcode height

Return Value

Variant that specifies safe array of the bytes.
Remarks
This method can be useful for sending the image over the Internet. For example, it can be used by the IIS server.

Warning! For this feature to function properly, you should have the GDI+ library (gdiplus.dll) installed on your PC, this library is distributed with Windows XP and higher. if you do not have this library, you can download it here, and copy it to the folder "../Windows/System32/".

Example
There is a short example of the ASP page distributed together with DataMatrix ActiveX Control.
<%
' datamatrix.asp
' (c) 1999-2005 www.BarcodeTools.com

' we are sending a GIF image to the client
Response.ContentType = "image/gif"
Response.BinaryWrite Barcode.BinaryWritePicture("gif", 200, 200)

SET Barcode=nothing
%>
			



GetMatrixSize Method
This method calculates the matrix size needed to get the module of the necessary size. Module is a single cell in a matrix symbology used to encode one bit of data.

Syntax
object.GetMatrixSize(module, xRes, yRes, dmIn, dmOut, width, height)
Parameters
moduleA double that defines the matrix module.
xResA long value that defines the resolution in dpi) along X axis.
yResA long value that defines the resolution in dpi) along Y axis.
dmInThis value defines the units that should be used to specify module.
dmOutThis value defines the units that should be used to specify width and height.
widthA variable that receives the matrix width.
heightA variable that receives the matrix height.
Examples
Print DataMatrix with the module size of 40 Mils. The matrix must begin with X=10 mm, Y=10 mm
'open a current printer
Call DataMatrixCtrl1.BeginPrint("")

'gets the printer resolution ( in dpi - dots per inch)
Dim dpiX As Long, dpiY As Long
dpiX = GetDeviceCaps(Printer.hdc, LOGPIXELSX)
dpiY = GetDeviceCaps(Printer.hdc, LOGPIXELSY)

'gets the required matrix width and height in units determined by the dmOut parameter
Dim Width, Height
Call DataMatrixCtrl1.GetMatrixSize(40, dpiX, dpiY, dmMils, dmMM, Width, Height)

'prints the matrix
Call DataMatrixCtrl1.DrawMatrixToSize(10, 10, Width, Height, dmMM)

'close the printer
Call DataMatrixCtrl1.EndPrint


Save the matrix to a file so that the module is equal to 4 pixels.
'if dmIn and dmOut are specified in pixels, you do not have to specify the resolution (xRes, yRes), but it must not be equal to 0.
Dim Width, Height
Call DataMatrixCtrl1.GetMatrixSize(4, 1, 1, dmPixels, dmPixels, Width, Height)

Call DataMatrixCtrl1.SaveToImageFile(Width, Height, "c:\datamatrix.bmp")



GetMatrixWidth Method
This method calculates only matrix width needed to get the module of the necessary size.

Syntax
object.GetMatrixWidth(module, xRes, yRes, dmIn, dmOut)
Parameters
moduleA double that defines the matrix module.
xResA long value that defines the resolution in dpi) along X axis.
yResA long value that defines the resolution in dpi) along Y axis.
dmInThis value defines the units that should be used to specify module.
dmOutThis value defines the units that should be used to specify width and height.
Return value
DataMatrix width
See also
GetMatrixSize



GetMatrixHeight Method
This method calculates only matrix height needed to get the module of the necessary size.

Syntax
object.GetMatrixHeight(module, xRes, yRes, dmIn, dmOut)
Parameters
moduleA double that defines the matrix module.
xResA long value that defines the resolution in dpi) along X axis.
yResA long value that defines the resolution in dpi) along Y axis.
dmInThis value defines the units that should be used to specify module.
dmOutThis value defines the units that should be used to specify width and height.
Return value
DataMatrix height
See also
GetMatrixSize



FreezeEncode Method
This method pauses or resumes encoding the matrix. It makes sense to use this method in heavily loaded application, for example, web services, etc.

Syntax
object.FreezeEncode(bFreeze)
Parameters
bFreezeBoolean that specifies whether to pause encoding the matrix or not.
Return Value
No return value.
Example

You need to set several properties of the DataMatrix control. Each time some properties are set (PreferredFormat, DataToEncode, EncodingMode and others) the matrix is re-encoded, i.e. the Reed-Solomon codes are calculated, the matrix is build, etc. It takes a lot of CPU time. To improve the performance of the application, you can pause encoding and resume it only after all properties are set.
DataMatrixCtrl1.FreezeEncode (True)
DataMatrixCtrl1.DataToEncode = "1234567"
DataMatrixCtrl1.EncodingMode = eC40
DataMatrixCtrl1.PreferredFormat = f64x64
DataMatrixCtrl1.FreezeEncode (False)



 

  Home   Order   FAQs   Support   Reader

Copyright © 1999-2016, RKD Software & RKD System Inc., All rights reserved.
All trademarks mentioned are the property of their respective owners.