分数拿来,delphi6测试通过
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls;
type
TForm1 = class(TForm)
TreeView1: TTreeView;
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
MyTreeNode1,MyTreeNode2: TTreeNode;
bstring,cstring:tstringlist;
I,icount:integer;
begin
TreeView1.Items.clear;
MyTreeNode1:=TreeView1.Items.add(nil,'北京');
MyTreeNode2:=TreeView1.Items.add(nil,'上海');
bstring:=tstringlist.Create;
cstring:=tstringlist.Create;
for I:=0 to 5 do
begin
bstring.add(inttostr(i)); //给bstring赋值 ,
end;
for I:=10 to 20 do
begin
cstring.add(inttostr(i)); //给bstring赋值 ,
end;
for icount:=0 to bstring.Count-1 do
begin
TreeView1.Items.AddChild(MyTreeNode1,bstring.Strings[icount]);
end;
for icount:=0 to cstring.Count-1 do
begin
TreeView1.Items.AddChild(MyTreeNode2,cstring.Strings[icount]);
end;
end;
end.