如何知道Memo组件当前的文本行数?

解决方案 »

  1.   

    iCount := SendMessage(Memo2.Handle, EM_GETLINECOUNT, 0, 0);===============================================================
         ◆◆◆ CSDN查询助手,查询方便快捷 ◆◆◆ 下载地址:  
     http://CoolSlob.ifood1.com/Download/CSDNFinder.exe  
     http://CoolSlob.8u8.com/Download/Tools/CSDNFinder.Slob[更名为.exe即可]  
      

  2.   

    你可以调用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; 
      

  3.   

    SendMessage(Memo.Handle, EM_GETLINECOUNT, 0, 0);
      

  4.   

    Memo.lines.count?  不行吗