TBarCode.NET 11 Developer Reference TBarCode.NET 11 (Windows)

◆ DrawBitmap() [2/2]

Bitmap TECIT.TBarCode.Barcode.DrawBitmap ( int  width,
int  height 
)
inline

Draws the barcode into a bitmap.

The parameters width and height specify the size of the whole bitmap. The BoundingRectangle specifies the size of the barcode in the bitmap. If the bar code resolution should follow the Dpi property, set IgnoreDpiFromDC = true.

This example draws a barcode-bitmap that is 200 x 75 pixels large:

Barcode barcode = new Barcode();
...
barcode.BoundingRectangle = new Rectangle(0, 0, 200, 75);
Bitmap bitmap = barcode.DrawBitmap(200, 75);
Bitmap DrawBitmap(int width, int height)
Draws the barcode into a bitmap.
Definition Barcode_Drawing.cs:618
A class to draw linear and 2d barcodes.
Definition Barcode.cs:18
@ Rectangle
Draw the bars as filled rectangles.


The following example draws a barcode that is centered in a bitmap. A border of 10 pixels (in background color) surrounds the barcode.

Barcode barcode = new Barcode();
...
barcode.BoundingRectangle = new Rectangle(10, 10, 180, 80);
Bitmap bitmap = barcode.DrawBitmap(200, 100);

For this method the unit of the bounding rectangle values, width and height is pixel. Be aware of the system limit of GDI objects: Dispose() the returned bitmap to free up consumed GDI handles immediately.

Parameters
widthThe width of the bitmap [Pixels].
heightThe height of the bitmap [Pixels].
Returns
Bitmap with barcode.

© 2024 All rights reserved by TEC-IT Datenverarbeitung GmbH
Generated on Tue Mar 26 2024 20:14:47 for TBarCode.NET 11 Developer Reference with doxygen 1.9.8