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

detect if my pplabel has resized during a wordwrap?

edited June 2006 in General
Hi,

Im using Delphi 7 and ReportBuilder 10.02. Is it possible to detect if my
pplabel automatically expand from its original size when it encounters huge
amount of text rather than using length(var)?

Because right now im using this piece of code

pplabelonprint event
if length(pplabel.caption) < 20 then pplabel.height := .2

thanks a lot..

Comments

  • edited June 2006
    Hi Alvin,

    If you have access to the text before the label is resized, you can use the
    TCanvas.TextWidth routine to find the width. For instance, you could create
    a TBitmap and use its Canvas to do this.

    lBitmap := TBitmap.Create;

    lBitmap.Canvas.Font := lFont;

    liWidth := lBitmap.Canvas.TextWidth(lsMyText);

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