Class BarcodeObject
Represents a barcode object. Represents a barcode object.
Implements
Inherited Members
Namespace: FastReport.Barcode
Assembly: FastReport.Base.dll
Syntax
public class BarcodeObject : ReportComponentBase, IFRSerializable
Remarks
The instance of this class represents a barcode. Here are some common actions that can be performed with this object:
- To select the type of barcode, use the Barcode property.
- To specify a static barcode data, use the Text property. You also may use the DataColumn or Expression properties to specify dynamic value for a barcode.
- To set a barcode orientation, use the Angle property.
- To specify the size of barcode, set the AutoSize property to true and use the Zoom property to zoom the barcode. If AutoSize property is set to false, you need to specify the size using the Width and Height properties.
Examples
This example shows how to configure the BarcodeObject to display PDF417 barcode.
BarcodeObject barcode;
...
barcode.Barcode = new BarcodePDF417();
(barcode.Barcode as BarcodePDF417).CompactionMode = CompactionMode.Text;
Constructors
BarcodeObject()
Initializes a new instance of the BarcodeObject class with default settings.
Declaration
public BarcodeObject()
Properties
AllowExpressions
Enable or disable of using an expression in Text
Declaration
public bool AllowExpressions { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Angle
Gets or sets the angle of barcode, in degrees.
Declaration
public int Angle { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
AsBitmap
Gets or sets values for forced use of a bitmap image instead of a vector
Declaration
public bool AsBitmap { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
AutoSize
Gets or sets a value that determines whether the barcode should handle its width automatically.
Declaration
public bool AutoSize { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Barcode
Gets or sets the barcode type.
Declaration
public BarcodeBase Barcode { get; set; }
Property Value
Type | Description |
---|---|
BarcodeBase |
Brackets
Gets or sets brackets for using in expressions
Declaration
public string Brackets { get; set; }
Property Value
Type | Description |
---|---|
System.String |
DataColumn
Gets or sets a data column name bound to this control.
Declaration
public string DataColumn { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
Value must be in the form "Datasource.Column".
Expression
Gets or sets an expression that contains the barcode data.
Declaration
public string Expression { get; set; }
Property Value
Type | Description |
---|---|
System.String |
HideIfNoData
Gets or sets a value that determines whether it is necessary to hide the object if the barcode data is empty.
Declaration
public bool HideIfNoData { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
HorzAlign
Gets or sets the horizontal alignment of a Barcode object.
Declaration
public BarcodeObject.Alignment HorzAlign { get; set; }
Property Value
Type | Description |
---|---|
BarcodeObject.Alignment |
NoDataText
Gets or sets the text that will be displayed if the barcode data is empty.
Declaration
public string NoDataText { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Padding
Gets or sets padding within the BarcodeObject.
Declaration
public Padding Padding { get; set; }
Property Value
Type | Description |
---|---|
Padding |
ShowMarker
Gets or sets values for hiding or showing barcode markers
Declaration
public bool ShowMarker { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
ShowText
Gets or sets a value that indicates if the barcode should display a human-readable text.
Declaration
public bool ShowText { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
SymbologyName
Gets or sets the symbology name.
Declaration
public string SymbologyName { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
The following symbology names are supported:
- "2/5 Interleaved"
- "2/5 Industrial"
- "2/5 Matrix"
- "Codabar"
- "Code128"
- "Code39"
- "Code39 Extended"
- "Code93"
- "Code93 Extended"
- "EAN8"
- "EAN13"
- "MSI"
- "PostNet"
- "UPC-A"
- "UPC-E0"
- "UPC-E1"
- "Supplement 2"
- "Supplement 5"
- "PDF417"
- "Datamatrix"
- "QRCode"
Examples
barcode.SymbologyName = "PDF417";
(barcode.Barcode as BarcodePDF417).CompactionMode = CompactionMode.Text;
Text
Gets or sets the barcode data.
Declaration
public string Text { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Zoom
Gets or sets a zoom of the barcode.
Declaration
public float Zoom { get; set; }
Property Value
Type | Description |
---|---|
System.Single |
Methods
Assign(Base)
Copies the contents of another, similar object.
Declaration
public override void Assign(Base source)
Parameters
Type | Name | Description |
---|---|---|
Base | source | Source object to copy the contents from. |
Overrides
Remarks
Call Assign to copy the properties from another object of the same type. The standard form of a call to Assign is
destination.Assign(source);
which tells the destination object to copy the contents of the source object to itself. In this method, all child objects are ignored. If you want to copy child objects, use the AssignAll method.
See Also
CreateSwissQR(QRSwissParameters)
Initialize current BarcodeObject as Swiss QR.
Declaration
public void CreateSwissQR(QRSwissParameters parameters)
Parameters
Type | Name | Description |
---|---|---|
QRSwissParameters | parameters | Parameters of swiss qr. |
Draw(FRPaintEventArgs)
Declaration
public override void Draw(FRPaintEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
FRPaintEventArgs | e |
Overrides
GetData()
Gets the data from a datasource that the object is connected to.
Declaration
public override void GetData()
Overrides
Remarks
This method is called by the report engine before processing the object.
Do not call it directly. You may override it if you are developing a new FastReport component. In this method you should get the data from a datasource that the object is connected to.
GetDataAsync(CancellationToken)
Declaration
public override async Task GetDataAsync(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Threading.CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Overrides
GetExpressions()
Gets all expressions contained in the object.
Declaration
public override string[] GetExpressions()
Returns
Type | Description |
---|---|
System.String[] | Array of expressions or null if object contains no expressions. |
Overrides
Remarks
Do not call this method directly. You may override it if you are developing a new component for FastReport.
This method is called by FastReport each time before run a report. FastReport do this to collect all expressions and compile them. For example, GetExpressions method of the TextObject class parses the text and returns all expressions found in the text.
RelocateAlign()
Relocate BarcodeObject based on alignment
Declaration
public void RelocateAlign()
RestoreState()
Restores the object's state after printing it.
Declaration
public override void RestoreState()
Overrides
Remarks
This method is called by the report engine after processing the object.
Do not call it directly. You may override it if you are developing a new FastReport component. In this method you should restore the object properties that were saved by the SaveState() method.
SaveState()
Saves the object's state before printing it.
Declaration
public override void SaveState()
Overrides
Remarks
This method is called by the report engine before processing the object.
Do not call it directly. You may override it if you are developing a new FastReport component. In this method you should save any object properties that may be changed during the object printing. The standard implementation saves the object's bounds, visibility, bookmark and hyperlink.
Serialize(FRWriter)
Serializes the object.
Declaration
public override void Serialize(FRWriter writer)
Parameters
Type | Name | Description |
---|---|---|
FRWriter | writer | Writer object. |
Overrides
Remarks
Do not call this method directly. You should override it if you are developing a new component for FastReport.
This method is called when the object needs to save the state. It may happen when:
- saving the report to the file or stream;
- saving the report to the designer's undo buffer;
- assigning the object to another object using the Assign(Base) or AssignAll methods;
- saving the object to the designer's clipboard;
- saving the object to the preview (when run a report).
UpdateAutoSize()
Declaration
public void UpdateAutoSize()