Web.BarcodeControl
TECIT.TBarCode.Web.BarcodeControl
Base types: WebControl, INamingContainer
An ASP.NET 4.5 control which renders a barcode.
There are two ways to set the data of the barcode:
-
The contents of the barcode can be set directly by using the property Barcode.TECIT.TBarCode.Barcode.Data.
-
The Barcode control can be bound to another control on the same page (see property Source). The contents of the source control will be encoded in the barcode.
The Refresh Button:
By default, the control contains a "Refresh" button that needs to be clicked by a user to update the barcode.
The "Refresh" button can be disabled and hidden. In this case the application needs to call Refresh to update the barcode.
Barcode Resolution:
The barcode can be optimized for different resolutions. The default resolution is the screen resolution (96 dpi). This ensure that the barcode will be readable directly on the screen. By setting a higher resolution (see Barcode.TECIT.TBarCode.Barcode.Dpi) the barcode can be optimized for other output devices.
For example, when setting 600 dpi the barcode (in most cases) won't be readable in the web browser. But the barcode will be perfectly readable when printing the web page on a 600 dpi printer.
(Background info: The resolution of the barcode is handled the following way: First we assume that the screen resolution is 96 DPI, which should fit most monitors. Then the barcode image is drawn bigger depending on the desired resolution. For example, if the desired resolution is 192 DPI then the image is rendered twice as big. The barcode image is then display in the web control using the original size. I.e. the web browser shows a scaled down image. If you zoom in (e.g. in Opera browser) or if you print the page, the barcode will be drawn with the correct resolution (e.g. 192 DPI).
Barcode cache:
The barcode images are temporarily cached on the web server (see CacheType). When barcodes are cached in memory then a BarcodeHttpHandler needs to be installed for the web application. This achieved by adding a single line to the web.config file of the application (see BarcodeHttpHandler).
Constructors
| Name | Description |
|---|---|
| BarcodeControl | Constructor. |
Methods
| Name | Description |
|---|---|
| CreateChildControls | Is called to create the child controls of this control. |
| Refresh | Set the refresh flag. |
Properties
| Name | Description |
|---|---|
| Barcode | Gets or sets the barcode properties. |
| BarcodeId | Retrieves or sets the identifier of the current barcode image. |
| BarcodeImageExists | Retrieves whether the barcode image already exists. |
| ButtonHeight | Gets or sets the height of the "Refresh" button. |
| ButtonText | Gets or sets the height of the "Refresh" button. |
| ButtonWidth | Gets or sets the width of the "Refresh" button. |
| Cache | Retrieves or sets the location where the barcode images shall be cached. |
| CacheDirectory | Retrieves or sets the local directory in which the bar codes shall be cached. |
| CacheTime | Retrieves or sets the time span [min] that a barcode image is cached for. |
| ColorDepth | Gets or sets the color depth of the barcode bitmap. |
| ErrorHandling | Gets or set kind of error handling. |
| Height | Retrieves or sets the height of the barcode control. |
| ImageFormat | Gets or sets the image format of the barcode bitmap. |
| ImageHeight | Retrieves the actual height of the barcode image. |
| ImageUrl | Retrieves the URL of the barcode image. |
| ImageWidth | Retrieves the actual width of the barcode image. |
| ShowButton | Gets or sets the visibility of the Refresh-button. |
| Source | Retrieves or sets the control ID of the data source. |
| Spacing | Gets or sets the minimal space between the barcode area and the Refresh button [px]. |
| Width | Retrieves or sets the width of the barcode control. |