5,939
社区成员
发帖
与我相关
我的任务
分享
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
my2=class(TWinControl)
private
tex: Tlabel;
pic: Timage;
public
constructor create(AOwner: TComponent; AParent: TWinControl);
//procedure Create(aOwner : Tcomponent);
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{ my2 }
constructor my2.create(AOwner: TComponent; AParent: TWinControl);
begin
tex:=Tlabel.Create(AOwner);
tex.Parent:=AParent;
tex.Caption:='hehe';
tex.Visible:=true;
pic:=Timage.Create(AOwner);
//pic.Picture.LoadFromFile('logo.jpg');
pic.Parent:=AParent;
pic.Visible:=true;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
lable: my2;
i : integer;
begin
i := i + 1;
// SetLength(sz,i);
lable := my2.create(Self,Form1);
// lable.Top:=i*10;
// lable.Left:=i*6;
// sz[i-1] := lable;
// label1.Caption:=inttostr(i);
end;
end.