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

How to get the Width of a changing Labels?

edited November 2006 in RAP
Hello

Delphi7, RB 7.04

In my report, i must change some Label.Captions, depending of the settings
of the user.
I did it in the OnCreate-Event in RAP.
But the Width-Property shows all the times the width of the old captions, no
matter if AutoSize is true or not.
How can i get the new width of a Label?
Depending on their new Width, i must calculate their new Left Position.

Thanks,
J?rgen

Comments

  • edited November 2006
    Hi J?rgen,

    First, try using the OnDrawCommandCreate event to see if you can get the
    actual width (in microns) of the label with the new caption. If this proves
    to be too difficult, you may need to create a passthru function that
    measures the width of a line of text. This can be done rather easily using
    the TCanvas.TextWidth() routine in Delphi.

    --
    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.