Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Get the width of a component

edited November 2009 in General
I put some ppDBText on the report at runtime. If I know that my ppDBText
containt x characters and use the y font what's the size of that
components?

I know that with proportional fonts it's impossibile to know, but I need
only an estimate.

Thanks.

Comments

  • edited November 2009
    Hi Lithian,

    I suggest using the TCanvas.TextWidth routine to determine the width of a
    text object. If you just need an approximate value, you can use the Canvas
    property of a TBitmap. Once you assign the proper font, the value will be
    given to you in Screen Pixels so it may need to be converted after that.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.