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

Print and Display Text

edited October 2003 in Component Writing
Hi,

I have a problem when I display and print the text in my custom component,
this is due to the extra space between characters of the text on the screen
is different when it print on the printer device, so what happen is that the
text may display one line on the screen while it may be wrapped when it
prints. What should I do for it to get WHAT YOU SEE IS WHAT YOU GET?

BTW, I use Win API DrawText to calculate the text rect, and display/print
it.

Thanks

William

Comments

  • edited October 2003

    In general for any sizing, you have to use the Printer's device context.

    Check out the ppCtrls.pas unit, the method TppCustomText.AdjustBounds uses
    the Printer's device context to measure the size required for the text.



    --
    Nard Moseley
    Digital Metaphors
    http://www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.