F
foolboy007
Unregistered / Unconfirmed
GUEST, unregistred user!
功能是把文本竖排,从右至左
======================
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ComCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
OpDlg: TOpenDialog;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var s:array[1..20,1..20] of string;
ss:Tstrings;
sfile:textfile;
i,j:integer;
begin
ss:=memo1.lines;
if opdlg.execute then
begin
assignfile(sfile,opdlg.FileName);
reset(sfile);
// form a word martix
for i:=20 downto 1 do
for j:=1 to 20 do
begin
Read(sfile,s[i,j]);
if j=20 then
s[i,j]:=s[i,j]+#13+#10;// add an enter at the end of line
end;
//now we put these words verticlly
for i:=1 to 20 do
for j:=1 to 20 do
ss.strings[0]:=s[i,j]+ss.strings[0];
memo1.lines:=ss;
end
else messagebox(handle,'open file error','error',MB_ok);
end;
end.
======================
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ComCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
OpDlg: TOpenDialog;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var s:array[1..20,1..20] of string;
ss:Tstrings;
sfile:textfile;
i,j:integer;
begin
ss:=memo1.lines;
if opdlg.execute then
begin
assignfile(sfile,opdlg.FileName);
reset(sfile);
// form a word martix
for i:=20 downto 1 do
for j:=1 to 20 do
begin
Read(sfile,s[i,j]);
if j=20 then
s[i,j]:=s[i,j]+#13+#10;// add an enter at the end of line
end;
//now we put these words verticlly
for i:=1 to 20 do
for j:=1 to 20 do
ss.strings[0]:=s[i,j]+ss.strings[0];
memo1.lines:=ss;
end
else messagebox(handle,'open file error','error',MB_ok);
end;
end.