How to get MEMO's rows and columns

zhaozj2021-02-17  50

New application, add two TLABEL components named Label1, label2 on the form form1;

Add two TBUTTON components named button1, button2; add a TMEMO component named MEMO1.

Then add the following code in the code editor.

Void __fastcall tform1 :: button1click (Tobject * Sender)

{

Label1 → CAPTION = SendMessage (Memo1 → Handle, EM_LINEFROMCHAR, -1, 0) 1;

}

Void __fastcall tform1 :: button2click (Tobject * Sender)

{

Label2 → CAPTION = MEMO1 → SELSTART-SendMessage (Memo1 → Handle, EM_LINEINDEX, -1, 0) 1;

}

This method is equally applicable to Richedit.

转载请注明原文地址:https://www.9cbs.com/read-29169.html

New Post(0)