Here are a couple of snippets of code I got from Borland's Community. These <u>should</u> also work with TRichEdit. The first shows the number of lines a TMemo component is capable of showing.<br><br>void __fastcall TForm1::MemoLinesShowingClick(TObject *Sender)<br>{<br> int Result;<br> TRect R;<br> Memo1->Perform(EM_GETRECT, 0,int(&R));<br> Result = (R.Bottom - R.Top) / Canvas->TextHeight('XXX');<br> Memo1->Lines->Add(Result);<br>}<br><br> This code assumes that the form's and memo's font is the same. If it is not, the program must also take into account the size of the font.<br><br> The second shows the current line you are on in TMemo.<br><br>void __fastcall TForm1::Button1Click(TObject *Sender)<br>{<br> int LineNumber;<br> LineNumber = SendMessage(Memo1->Handle, EM_LINEFROMCHAR, -1 , 0);<br> ShowMessage(LineNumber);<br>}<br><br> If the two are equal, you have reached the maximum. I haven't tested it, but I <b>think</b> that TMemo will delete the oldest lines when the newest is added.<br> <p>James P. Cottingham<br><a href=mailto: > </a><br><a href=
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.