Examples Delphi

Retrieving the line number that a memo's cursor is on.
Question:
How can I retrieve the line number that a memo's cursor is on?
Answer:
The zero based location of the cursor can be retrieved by sending
an EM_LINEFROMCHAR message. WParam contains the character number that
you wish the line number for, or -1 for the current line (where the
caret is located or the beginning of a text selection).

Example:

LineNumber := Memo1.Perform(EM_LINEFROMCHAR, -1, 0);