SetLength(bb,screen.Imes.Count); for j:=0 to screen.Imes.Count-1 do begin BB[j]:=screen.imes.strings[j]; end;
unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TAgeData = array of string; {------------声明} TForm1 = class(TForm) Button1: TButton; ListBox1: TListBox; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end;var Form1: TForm1; function lst:TAgeData;{------------------------声明返回数组的函数} implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject); var a:TAgeData; i:integer; begin {---------------------将输入法列表添加到ListBox1中} a:=lst; for i :=low(a) to High(a) do ListBox1.Items.Add(a[i]); end;function lst:TAgeData; {---------------------函数实体} var bb:TAgeData; j:integer; begin SetLength(bb,screen.Imes.Count); for j:=0 to screen.Imes.Count-1 do begin BB[j]:=screen.imes.strings[j]; end; Result:=bb; SetLength(bb,0); end;end.
SetLength(bb,screen.Imes.Count);
for j:=0 to screen.Imes.Count-1 do
begin
BB[j]:=screen.imes.strings[j];
end;
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type TAgeData = array of string; {------------声明}
TForm1 = class(TForm)
Button1: TButton;
ListBox1: TListBox;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;
function lst:TAgeData;{------------------------声明返回数组的函数}
implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
var
a:TAgeData;
i:integer;
begin
{---------------------将输入法列表添加到ListBox1中}
a:=lst;
for i :=low(a) to High(a) do
ListBox1.Items.Add(a[i]);
end;function lst:TAgeData; {---------------------函数实体}
var
bb:TAgeData;
j:integer;
begin
SetLength(bb,screen.Imes.Count);
for j:=0 to screen.Imes.Count-1 do
begin
BB[j]:=screen.imes.strings[j];
end;
Result:=bb;
SetLength(bb,0);
end;end.