在线等待:如何得到Memo或RichEdit控件中光标位置?? 在线等待:如何得到Memo或RichEdit控件中光标位置??如果光标在这类文本控件中,如何能得到光标的位置。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 procedure TForm1.Button1Click(Sender: TObject);varLineNum:longint;CharsBeforeLine:longint;begin LineNum:=SendMessage(Memo1.Handle,EM_LINEFROMCHAR,Memo1.SelStart,0); CharsBeforeLine:=SendMessage(Memo1.Handle,EM_LINEINDEX,LineNum,0); showmessage(inttostr(linenum)); showmessage(inttostr(memo1.SelStart)); showmessage(inttostr(CharsBeforeLine)); Label1.Caption:='Line'+IntToStr(LineNum+1) ; Label2.caption:='Position'+IntToStr((Memo1.SelStart-CharsBeforeLine)+1);end; var i:integer;begin i:=richedit1.selstart;/变量i保存的就是richedit中的光标位置..end; 如果有错,不要笑我...欢迎指教.... 不好意思,我又试过了,我用void __fastcall Form1::Memo1Change(){ Label1->Caption=IntToStr(Memo1->SelStart);}还真实现了。确实是SelStart是光标当前位置,虽然没有选中任何内 richedit1.CaretPos.x :光标在框中的行坐标位置;richedit1.CaretPos.y :光标在框中的列坐标位置; 无线路由器限流问题 【散分】 注册一周年,散分纪念一下 急救!SPCOMM控件的问题 如何在delphi中表示当前记录? 请问谁有第三方控件 谁用过armadillo3.01? 二○○分:讨论串口通信,进来UPUP吧,多谢…… 請教大蝦,在DELPHI 6中怎樣取得一台机器的网卡號? 怎么没人回答,不会送分都不要? 变量、指针的释放问题 在dbgrid中如操作对应的列行的值? 如何在dll中加入form?
var
LineNum:longint;
CharsBeforeLine:longint;
begin
LineNum:=SendMessage(Memo1.Handle,EM_LINEFROMCHAR,Memo1.SelStart,0);
CharsBeforeLine:=SendMessage(Memo1.Handle,EM_LINEINDEX,LineNum,0);
showmessage(inttostr(linenum));
showmessage(inttostr(memo1.SelStart));
showmessage(inttostr(CharsBeforeLine));
Label1.Caption:='Line'+IntToStr(LineNum+1) ;
Label2.caption:='Position'+IntToStr((Memo1.SelStart-CharsBeforeLine)+1);
end;
i:integer;
begin
i:=richedit1.selstart;/变量i保存的就是richedit中的光标位置..
end;
如果有错,不要笑我...欢迎指教....
我用
void __fastcall Form1::Memo1Change()
{
Label1->Caption=IntToStr(Memo1->SelStart);
}
还真实现了。
确实是SelStart是光标当前位置,虽然没有选中任何内
richedit1.CaretPos.y :光标在框中的列坐标位置;