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

TppDbText.AutoSize problem !

edited September 2002 in General
Hi !

Delphi : 5 upd 1
ReportBuilder : 6.03

I have a TppDBText on my group header band, and the contains is changed on
every groups. I have a TppLine that I'm trying to set his width to fit with
the TppDBText, and it's never the true width. How to synchronize the line
???

Simple problem !

Tanx
Fred

Comments

  • edited September 2002
    The autosizing is determined by the rendering device, and is not set on the
    width property of the control. Since you should not rely on the width
    property, you need to measure the text width in code using the current
    device's canvas.

    When you are printing to the printer, set the printer canvas font to be the
    dbText font and then use the Printer.Canvas.TextWidth method. Use the
    Report.Printer property to access the current printer when printing. When
    you are printing, you can check to see if the printer device is non nil to
    determine if you should use the screen canvas or printer canvas to measure
    the text.

    if (Report.PrinterDevice <> nil) then
    use printer canvas
    else
    use screen canvas;

    Cheers,

    Jim Bennett
    Digital Metaphors

This discussion has been closed.