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

Vertically center text in TppMemo

edited January 2009 in General
Hi,

How can I center text vertically within a TppMemo?

I have scoured the newsgroups and didn't find anything on this except for
one from back in 2001 that gave an overview involving capturing the
OnDrawCommandCreate and such that was way over my head! It seems this would
be a relatively common thing to do. Is there easy way... or is there a
complicated way with some sample code? ;-)

Thanks,
Danny

Comments

  • edited January 2009


    I created a new rbWiki example that shows how to do this..

    www.digital-metaphors.com/rbWiki/Delphi_Code/Formatting/Vertically_Center_Memo_Text


    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited January 2009
    Nard,

    Wow! Thanks! I'll give that a try.

    Danny

  • edited January 2009
    Nard,

    That works great on my machine but for some reason I just get little square
    boxes on the print preview on any machine that not running Vista.

    Any idea what could be causing that?

    Thanks,
    Danny


  • edited January 2009
    Clarification: the little square boxes are above the text in the memo.


  • edited January 2009
    Nard,

    I have solved the "little square boxes" mystery. The boxes are actually the
    CR/LF characters.

    The solution is to replace the following from your example:

    lDrawText.WrappedText.Insert(0,#13#10);

    with:

    lDrawText.WrappedText.Insert(0,'');

    I guess it was not necessary to add CR/LF because the WrappedText.Insert
    method actually adds lines and not characters.

    Thanks,
    Danny
  • edited January 2009


    Thanks for the tip. I updated the rbWiki example. :)


    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

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