unit U_FormMian;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,ExtCtrls,StdCtrls, ImgList;
type
TForm_Main = class(TForm)
ImageList1: TImageList;
procedure FormCreate(Sender: TObject);
procedure btClick(Sender: TObject);
procedure baClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form_Main: TForm_Main;
pa:TPanel;
pb:TPanel;
// pc:TPanel;
bt:Tbutton;
ba:Tbutton;
memo:TMemo;
implementation
uses Unit2;
{$R *.dfm}
procedure TForm_Main.FormCreate(Sender: TObject);
begin
pa:=TPanel.Create(self);
//pa.Caption:='mubiaota';
pa.Left:=0;
pa.Top:=50;
pa.Width:=150;
pa.Height:=250;
pa.Align:=alLeft;
pa.Parent:=Self;
pb:=TPanel.Create(self);
pb.Left:=150;
pb.Width:=538;
pb.Align:=alTop;
pb.Parent:=self;
bt:=TButton.Create(self);
bt.Caption :='读取文件';
bt.Left:=23;
bt.Top:=20;
// bt.Width := 100;
//bt.Height := 50;
bt.Align := alNone;
bt.Parent :=pa;
bt.OnClick:= btClick;
// Memo1.Lines.Clear;
ba :=TButton.Create(self);
ba.Left:=23;
ba.Top:= 60;
ba.OnClick:= baClick;
ba.Caption:= '退出';
ba.Parent:=pa;
memo:=TMemo.Create(self);
memo.Align:=alClient;
memo.Parent:=pb;
//pb.Visible:=false;
//ComboBox1.Text:='请选择';
end;
procedure TForm_Main.btClick(Sender: TObject);
var
op:TOpenDialog;
str:string;
str1:TStringList;
i:integer;
//pb:TPanel;
begin
memo.Clear;
str1:=TStringList.Create;
op:=TOpenDialog.Create(self);
//op :=TOpenDialog.Create(self);
if op.Execute then
begin
str1.LoadFromFile(op.FileName);
for i:= 0 to str1.Count-1 do
begin
memo.Lines.Add(str1.Strings);
end;
end;
end;
procedure TForm_Main.baClick(Sender: TObject);
var
pForm:TForm2;
begin
pForm:=TForm2.Create(self);
//pForm.Parent:=TForm2;
pForm.Show;
end;
end.
全部是动态的 看看吧 很久不写程序了