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

fixed length Line under Memo

edited January 2006 in General
I want to write a line with fixed length (so can't use UnderLine because it
depends on the field content), I placed a tppline under Memo control, but if
the memo stretch, how to allow the tppline to rewrite according to the line
of the memo displayed.
e.g.
if 1 line:
___________________________
but if the memo stretch to 3 lines, how to draw this line three times? (no
know how much the memo will stretch before the report print...)

Thx!!

Comments

  • edited January 2006
    Hi Kei,

    My suggestion would be to first determine how many lines your memo will
    contain, then manually add line drawcommands in the places you need. You
    could possibly use the TCanvas.TextHeight routine to measure where the lines
    should be placed. I would try the OnPrint event initially and check the
    Memo.Lines.Count property.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited January 2006
    Oh, it seems very complex like drawcommands..., which component onPrint
    event.., could you give some sample code for me to follow?
    Thx!!

  • edited January 2006
    Kei,

    How about placing a second memo object and adding the lines to this object
    once you know the number of lines in the first memo. I have not given it a
    try to know the correct event, but I would guess that in the BandAfterPrint
    you could do something like the following:

    for i = 0 to Memo1.Lines.Count - 1 do
    begin
    Memo2.Lines.Add('____________');
    end;

    --

    Bob

  • edited January 2006
    Hi Kei,

    Below is some code you can use to create line drawcommands. Try the
    OnCreateDrawCommand of the memo object instead. I would definitely try
    Bob's suggestion first as it is a much simpler solution.

    lDrawLine := TppDrawLine.Create(nil);
    lDrawLine.Page := ppReport1.Engine.Page;
    lDrawLine.LinePosition := lpTop;
    lDrawLine.Left := TppDrawText(aDrawCommand).Left;
    lDrawLine.Top := (Calculate the top position of the line);
    lDrawLine.Width := ppMemo1.MMWidth;

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