最
最笨菜鸟
Unregistered / Unconfirmed
GUEST, unregistred user!
我是想用两个RichEdit来处理文本,情况如下:
RichEdit1里有文本00000000000 RichEdit2里是用来显示处理完的文本
1111111111111 也就是去除换行的动作。
222222222
333333333333333
444444444444
55555555555555
6666666666666666
7777777777777
888888888888888888
99999999999999
但执行显示,结果却不是 0~9,而是错位的排列,如果是这样的话,去处理实际的文本文件,岂不乱套!!!
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ComCtrls;
type
TForm1 = class(TForm)
RichEdit1: TRichEdit;
RichEdit2: TRichEdit;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var
i,p:integer;
begin
i:=RichEdit1.Lines.Count;
p:=0;
While i>0 do
begin
RichEdit2.Lines[0]:=RichEdit2.Lines[0]+RichEdit1.Lines[p];
p:=p+1;
i:=i-1;
end;
end;
end.
RichEdit1里有文本00000000000 RichEdit2里是用来显示处理完的文本
1111111111111 也就是去除换行的动作。
222222222
333333333333333
444444444444
55555555555555
6666666666666666
7777777777777
888888888888888888
99999999999999
但执行显示,结果却不是 0~9,而是错位的排列,如果是这样的话,去处理实际的文本文件,岂不乱套!!!
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ComCtrls;
type
TForm1 = class(TForm)
RichEdit1: TRichEdit;
RichEdit2: TRichEdit;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var
i,p:integer;
begin
i:=RichEdit1.Lines.Count;
p:=0;
While i>0 do
begin
RichEdit2.Lines[0]:=RichEdit2.Lines[0]+RichEdit1.Lines[p];
p:=p+1;
i:=i-1;
end;
end;
end.