redt1里面有一些文本.
通过代码实现将redt1的内容原封不动的复制到redt2中.
用CopyToClipboard和PasteFromClipboard只能粘贴一次.
比如:
for i:=0 to 10 do
begin
redt1.selectAll;
redt1.CopyToClipboard;
redt2.PasteFromClipBoard;
end;
实际只粘贴了一次.最好不用剪切板,有没有别的办法?
通过代码实现将redt1的内容原封不动的复制到redt2中.
用CopyToClipboard和PasteFromClipboard只能粘贴一次.
比如:
for i:=0 to 10 do
begin
redt1.selectAll;
redt1.CopyToClipboard;
redt2.PasteFromClipBoard;
end;
实际只粘贴了一次.最好不用剪切板,有没有别的办法?
解决方案 »
- Delphi 从内存读取函数问题?
- 为什么我的combobox只能显示一行查询出的数据.
- 怎样在FindDialog中实现向前搜索?
- delphi里面有没有可以将时间(now)直接转化成MMDDHHMMSS形式的?
- 如何对edit组件进行数据错误验正?
- 高分求:怎样根据TMemo的行数设置Tmemo的高度,让Tmemo刚好能显示所有的文本?
- 小弟想自己开公司,各位大虾给点意见。
- 怎么生成只有数字和字母组成的注册码,并且可逆
- dll中数组指针参数,在delphi中如何对应声明? 答了立刻给分!急用.
- 请教一个关于ADOQUERY.filter的问题
- 是不是要用到继承?????
- 在一个事件下,修改二个注册表[rootkey不同]如何写啊?
cb: Longint; var pcb: Longint): Longint; Stdcall;
var
theStream: TStream;
dataAvail: LongInt;
begin
theStream := TStream(dwCookie);
with theStream do begin
dataAvail := Size - Position;
Result := 0; {assume everything is ok}
if dataAvail <= cb then begin
pcb := Read(pbBuff^, dataAvail);
if pcb <> dataAvail then {couldn't read req. amount of bytes}
result := E_FAIL;
end
else begin
pcb := Read(pbBuff^, cb);
if pcb <> cb then
result := E_FAIL;
end;
end;
end;Function EditStreamOutCallback(dwCookie: Longint; pbBuff: PByte;
cb: Longint; var pcb: Longint): Longint; stdcall;
var
theStream: TStream;
begin
theStream := TStream(dwCookie); with theStream do begin
If cb > 0 Then
pcb := Write(pbBuff^, cb);
Result := 0;
end;
end;Procedure GetRTFSelection (aRichEdit: TRichEdit; intoStream: TStream);
Var
editstream: TEditStream;
Begin
With editstream Do Begin
dwCookie:= Longint(intoStream);
dwError:= 0;
pfnCallback:= EditStreamOutCallBack;
end;
aRichedit.Perform( EM_STREAMOUT, SF_RTF or SFF_SELECTION,longint(@editstream));
End;Procedure PutRTFSelection (aRichEdit: TRichEdit; sourceStream: TStream);
Var
editstream: TEditStream;
Begin
sourceStream.Position := 0;
With editstream Do Begin
dwCookie:= Longint(sourceStream);
dwError:= 0;
pfnCallback:= EditStreamInCallBack;
end;
aRichedit.Perform( EM_STREAMIN, SF_RTF or SFF_SELECTION, longint(@editstream));
End;调用:
var
aMemStream:TMemoryStream;
I:Integer;
begin
redt1.SelectAll;
aMemStream := TMemoryStream.Create;
try
getRTFSelection (redt1, aMemStream);
for I:=0 to 10 do
putRTFSelection (redt2, aMemStream);
finally
aMemStream.Free;
end;
end;