使用MEMO控件的em_LineFromChar屬性,程序如下:
procedure TMyForm.BitBtn1Click(Sender: TObject);
var
iLine : Integer ;
begin
iLine := Memo1.Perform(em_LineFromChar, $FFFF, 0);
{ Note: 第一行為 0 }
messageDlg(Line Number: + IntToStr(iLine), mtInformation,
[mbOK], 0 ) ;
end;