unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
btn1: TButton;
procedure btn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.btn1Click(Sender: TObject);
const
st: array [0..1] of string =
(('日月忽其不淹兮'),('春与秋其代序'));
a: Integer = 20;
b: Integer = 20;
var
i,j:Integer;
x,y:Integer;
begin
//ShowMessage(st[0][1]);
x := 20;
y := 20;
for i := 0 to Length(st)-1 do
begin
for j := 1 to Length(st[i]) do
begin
Canvas.TextOut(x, y, st[i][j]);
x := x + Canvas.TextWidth(st[i][j]) + a;
end;
x := 20;
y := y + Canvas.TextHeight(st[i][j]) + b;
end;
end;
end.