怎么让TMemo中的光标到最后 有个CaretPos属性,但是是只读的,我要把光标设到最后,怎么办? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 procedure TForm1.Button1Click(Sender: TObject);beginMemo1.SetFocus ;memo1.SelStart :=length(memo1.Text );memo1.SelLength :=0;end; 你不会告诉我 Memo1.Enabled :=False吧,只读是Memo1.ReadOnly :=True 放在一个Button.Click里就可以了,我是放在Form.Show里面的,不行 当然是Memo1.ReadOnly :=True 放到OnCreate里:Show;Memo1.SetFocus ;memo1.SelStart :=length(memo1.Text );memo1.SelLength :=0; Memo1.Lines.LoadFromFile('test.txt');Memo1.SetFocus ;memo1.SelStart :=length(memo1.Text );memo1.SelLength :=0;把这段放在Form.Show里可以?放在一个Button.Click里试过是可以的,Form.Show不行我是窗口一打开就载入一个文件文件,然后想让光标定位到最后 OnCreat时能不能不Show,我的这个窗体是自动创建的 你就不会变通一下吗:var form2: TForm1;begin form2 := TForm1.Create(Self); with form2 do begin Show; Memo1.Lines.LoadFromFile('test.txt'); memo1.SelStart := length(memo1.Text); memo1.SelLength := 0; Memo1.SetFocus; end;end; 呵呵,我就是不能用局部的窗体变量:),因为这个窗体要常开着不过在您的上面代码上加个尾巴就可以了,这样Form.OnCreate里:Show;Memo1.SetFocus ;memo1.SelStart :=length(memo1.Text );memo1.SelLength :=0;Hide;:)多谢 delphi 的什么控件可以接受response 关于创建类中的 在一个窗体打开另一个窗体的释放问题 f9编译。出现File not found: 'RzGroupBar.dcu',走过路过不要错过! 用modem编程,如何用at命令来识别是否忙音?? 高分(100分)求助一个DELPHI程序 谁来帮帮我,在delphi中怎么调用word,excel等应用程序! 菜鸟问题?帮忙回答 关于Delphi中Tquery的释放内存问题 如何在delphi实现“即点即输”的功能 怎样连接SQL上的数据库(不用ODBC) 用TIdHTTP登陆 CSDN ,返回“请输入用户名!”,怎么回事? 寻求一本书
begin
Memo1.SetFocus ;
memo1.SelStart :=length(memo1.Text );
memo1.SelLength :=0;
end;
Show;
Memo1.SetFocus ;
memo1.SelStart :=length(memo1.Text );
memo1.SelLength :=0;
Memo1.SetFocus ;
memo1.SelStart :=length(memo1.Text );
memo1.SelLength :=0;把这段放在Form.Show里可以?放在一个Button.Click里试过是可以的,Form.Show不行
我是窗口一打开就载入一个文件文件,然后想让光标定位到最后
form2: TForm1;
begin
form2 := TForm1.Create(Self);
with form2 do
begin
Show;
Memo1.Lines.LoadFromFile('test.txt');
memo1.SelStart := length(memo1.Text);
memo1.SelLength := 0;
Memo1.SetFocus;
end;
end;
不过在您的上面代码上加个尾巴就可以了,这样Form.OnCreate里:Show;
Memo1.SetFocus ;
memo1.SelStart :=length(memo1.Text );
memo1.SelLength :=0;
Hide;:)
多谢