Event: OnDrawText
Occurs at discrete points during the representing (either displaying or printing) of the human readable text. Write an OnDrawText event handler to customize the representing of the human readable text at various stages before it is represented.
Syntax:
type
{ Defined in the pBarcode1D unit }
TBarcodeCustomParameters = record
Alpha: Double;
Origin: TPoint;
Offset: TPoint;
DensityRate: Double;
FullEncoded: string;
Text: string;
DisplayText: TDisplayText;
TextPosition: TTextPosition;
TextAlignment: TTextAlignment;
TextFont: TFont;
ExtraFontSize: Integer;
LeftQuietZone_Spacing: Integer;
RightQuietZone_Spacing: Integer;
LeftQuietZone_Width: Integer;
RightQuietZone_Width: Integer;
LeftQuietText_Height: Integer;
RightQuietText_Height: Integer;
Symbol_Width: Integer;
Symbol_Height: Integer;
Symbol_V_Offset: Integer;
Symbol_H_Offset: Integer;
Total_Left: Integer;
Total_Top: Integer;
Total_Width: Integer;
Total_Height: Integer;
end;
{ Defined in the pCore1D unit }
TDrawTextStep = (dtsPrepare, dtsClean, dtsPrint);
{ Defined in the pBarcode1D unit }
TOnDrawText = procedure (Sender: TObject; Canvas: TCanvas; Step: TDrawTextStep; var BarcodeParameters: TBarcodeCustomParameters; var Continue: Boolean; var LeftTop, RightBottom: TPoint; var PDx: PInteger) of object;
property OnDrawText: TOnDrawText;
Parameters:
- Sender: TObject; It is the object whose event handler is called.
- Canvas: TCanvas; The target canvas, the human readable text will be represented in it.
- Step: TDrawTextStep; Determine when an OnDrawText event occurs, It can have one of following values (defined in the pCore1D unit):
- dtsPrepare: Occurs before calculate the position and size of the human readable text. You can customizate the human readable text in this step.
- dtsClean: Occurs before erasing the background for human readable text.
- dtsPrint: Occurs before drawing(printing) the human readable text.
- BarcodeParameters: TBarcodeCustomParameters; It contains fields to specify the parameters (e.g. position, size, etc.) for the barcode symbol. It is defined in the pBarcode1D unit. If the Step parameter is dtsPrepare, you can change the values of Text, TextFont, TextPosition and TextAlignment fields, all changes to other fields will be ignored. The human readable text will not be displayed if you change the Text field to empty string. If the Step parameter is dtsClear or dtsPrint, all changes to the parameter will be ignored. The Orgin field is only available when Step parameter is dtsClear or dtsPrint. For the values of Symbol_V_Offset, Symbol_H_Offset, Total_Width and Total_Height fields, the human readable text aren't consulted if the Step parameter is dtsPrepare. See also the TBarcodeCustomParameters record.
- Continue: Boolean; Indicates whether the human readable text should continue with the default painting after the event handler exits. Set Continue to false to prevent the drawing of the human readable text after event handler exits. If Continue remains set to true, the human readable text continues with the default painting process.
- LeftTop: TPoint; The Point of the upper-left corner of the human readable text area before the barcode symbol is rotated, in pixels (Draw, DrawTo) or dots (Print). It is only available when Step parameter is dtsClear or dtsPrint. The point (0, 0) refers to the upper-left corner of entire barcode symbol (If the human readable text is displayed, it's included in the barcode symbol. For the TBarcode1D_UPCA, TBarcode1D_UPCE, TBarcode1D_UPCE0, TBarcode1D_UPCE1, TBarcode1D_EAN2, TBarcode1D_EAN5, TBarcode1D_EAN8, and TBarcode1D_EAN13 barcode components, if the human readable text is displayed, and the TextAlignment property or the ATextAlignment parameter is set to taCustom, the left and right quiet zones marks and their horizontal spacing are included in the barcode symbol too. For TBarcode1D_ITF6, TBarcode1D_ITF14, and TBarcode1D_ITF16 barcode components, all bearer bars, the left and right spacing are included in the barcode symbol too. If the human readable text is displayed and it exceeds the barcode symbol in horizontal or vertical direction, the excess is included in the barcode symbol too).
- RightBottom: TPoint; The Point of the lower-right corner of the human readable text area before the barcode symbol is rotated, in pixels (Draw, DrawTo) or dots (Print). It is only available when Step parameter is dtsClear or dtsPrint. The point (0, 0) refers to the upper-left corner of entire barcode symbol (If the human readable text is displayed, it's included in the barcode symbol. For the TBarcode1D_UPCA, TBarcode1D_UPCE, TBarcode1D_UPCE0, TBarcode1D_UPCE1, TBarcode1D_EAN2, TBarcode1D_EAN5, TBarcode1D_EAN8, and TBarcode1D_EAN13 barcode components, if the human readable text is displayed, and the TextAlignment property or the ATextAlignment parameter is set to taCustom, the left and right quiet zones marks and their horizontal spacing are included in the barcode symbol too. For TBarcode1D_ITF6, TBarcode1D_ITF14, and TBarcode1D_ITF16 barcode components, all bearer bars, the left and right spacing are included in the barcode symbol too. If the human readable text is displayed and it exceeds the barcode symbol in horizontal or vertical direction, the excess is included in the barcode symbol too).
- PDx: PInteger; Points to first element of an array, the array values indicate the distance between origins of adjacent character cells. It is only available when Step parameter is dtsPrint.
See diagram:
Contents
Copyright © 2001-2024
Han-soft Corporation. All rights reserved.