原题是:
在VCL的TControl类内定义一个发送消息的方法.声明如下:
Function Perform(Msg:Cardinal;WParam,LParam:longint):longint;
任何一个VCL组件对象可以通过调用Perform方法给组件本身发送消息.
但是必须注意,该函数发出消息后将等待消息处理完后,返回Result;
通过调用Perform方法的调用,实现在组件memo1中自动滚屏到最后一行.
procedure Tform1.scrollToend;
begin
with memo1 do
begin
SelStart:=Length(lines.text);
Perform(EM_SCROLLCARET,0,0);
SetFouns;
end;
end;-------------------------------------------------------------------
谁能把这个弄完把全部代码给我看下....分全部送上.
在VCL的TControl类内定义一个发送消息的方法.声明如下:
Function Perform(Msg:Cardinal;WParam,LParam:longint):longint;
任何一个VCL组件对象可以通过调用Perform方法给组件本身发送消息.
但是必须注意,该函数发出消息后将等待消息处理完后,返回Result;
通过调用Perform方法的调用,实现在组件memo1中自动滚屏到最后一行.
procedure Tform1.scrollToend;
begin
with memo1 do
begin
SelStart:=Length(lines.text);
Perform(EM_SCROLLCARET,0,0);
SetFouns;
end;
end;-------------------------------------------------------------------
谁能把这个弄完把全部代码给我看下....分全部送上.
with Memo1 do
begin
SelStart:=Length(Memo1.Text);
SelLength:=0;
SetFocus;
end;
执行完毕,光标移到Memo1的末尾。若要移到Memo1末行的起始,同理。
var
P1, P2: Integer;
begin
P1 := 0;
repeat
Memo1.Perform(WM_VSCROLL, SB_LINEDOWN, 0);
Application.ProcessMessages;
P2 := GetScrollPos(Memo1.Handle, SB_VERT);
until P1 = P2;
end;循环中间可以加Sleep延时
EM_SCROLLCARET是针对RichEdit的,且没有滚动效果
RichEdit1.SelStart := Length(RichEdit1.Text);
RichEdit1.Perform(EM_SCROLLCARET, 0, 0);
SB_BOTTOM
SB_ENDSCROLL
SB_LINEDOWN
SB_LINEUP
SB_PAGEDOWN
SB_PAGEUP
SB_THUMBPOSITION
SB_THUMBTRACK
SB_TOPprocedure Tform1.scrollToend;
begin
with memo1 do
begin
SelStart:=Length(lines.text);
Perform(WM_VSCROLL,SB_BOTTOM,0);
SetFouns;
end;
end;
SB_ENDSCROLL
SB_LINEDOWN
SB_LINEUP
SB_PAGEDOWN
SB_PAGEUP
SB_THUMBPOSITION
SB_THUMBTRACK
SB_TOP procedure Tform1.scrollToend;
begin
with memo1 do
begin
SelStart:=Length(lines.text);
Perform(WM_VSCROLL,SB_BOTTOM,0);
SetFouns;
end;
end;