TBarCode Library 11  TBarCode Library 11
ERRCODE _stdcall BCGetBarcodeSize ( t_BarCode pBarCode,
LPRECT  pRectBounding,
HDC  hDC,
e_MUnit  eUnit,
DOUBLE *  pdWidth,
DOUBLE *  pdHeight 
)

Computes the barcode size (recommended method).

Computes width and height of barcode with one call. You can use this function before you draw the barcode to ensure that there is enough space available. Call this function after BCCreate() and specify a bounding rectangle (target coordinates, where you would draw the barcode). This rectangle is relevant if you haven't specified a module width or a row height. As for the bounding rectangle pass in the same coordinates as you would use for drawing. Some symbologies have a specific width/height ratio and therefore the bar code size is adapted to fit into the bounding rectangle.
hDC can be NULL. In this case the bounding rectangle must be specified in 1/1000 mm. The measurement units are:

  • eMUDefault ... logical units of the given device context.
  • eMUMM ... millimeters
  • eMUPixel ... pixels if device context is given, otherwise points (= 1/72 inch)
    See also:
    BCGetBarcodeHeight(), BCGetBarcodeWidth()
    Note:
    Call this function after BCCreate(). Please take care of rotation if you use the result of this function to calculate the bounding rectangle for drawing. With a rotation of 90° or 270° the width is calculated from rect.top and rect.bottom and the height from rect.left and rect.right (return values depend on size mode and module width settings).
    Parameters:
    [in]pBarCodePointer to barcode structure.
    [in]pRectBoundingBounding rectangle.
    [in]hDCDevice context handle.
    [in]eUnitMeasurement unit.
    [in,out]pdWidthPointer to resulting width (NULL if not required).
    [in,out]pdHeightPointer to resulting height (NULL if not required).
    Return values:
    ERRCODEErrOk (0) in case of success. Non-zero if error occurred.