通过调用API确定MEMO控件中的当前行和列

[入库:2005年8月18日] [更新:2007年3月25日]

本文简介:选择自 showman 的 blog

通过调用api确定memo控件中的当前行和列

你可以调用windowsapi中的em—linefromchar和em—lineindex函数来确定mem
o控件中的当前行和列,具体调用的过程见下面的过程。
var
linenum:longint;
charsbeforeline:longint;
begin
linenumΚsendmessage(memo1.handle,em—linefromchar,memo1.selsta
rt,0);
charsbeforeline:=sendmessage(memo1.handle,em—lineindex,linenum
,0);
label1.caption:=′line′+inttostr(linenum+1)
label2.caption:=′position′+inttostr((memo1.selstart-charsbe
foreline)+1);
end;

本文关键:通过调用API确定MEMO控件中的当前行和列
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top