急!在线等! 简单问题:如何动态向GroupBox添加Label控件(50)

  • 主题发起人 主题发起人 nantwww
  • 开始时间 开始时间
N

nantwww

Unregistered / Unconfirmed
GUEST, unregistred user!
[:(!]如何动态向GroupBox添加Label控件
 
各位高手请帮帮忙
 
unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Button1: TButton; GroupBox1: TGroupBox; procedure Button1Click(Sender: TObject); procedure FormShow(Sender: TObject); private { Private declarations } public { Public declarations } end;var Form1: TForm1;implementationvar i:integer; lbl:array[1..100] of Tlabel;{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);begin lbl:=Tlabel.Create(self); lbl.Caption:='lable'+inttostr(i); lbl.Parent:=GroupBox1; lbl.Height:=24; lbl.Width:=50; lbl.Top:=24*i+2; inc(i);end;procedure TForm1.FormShow(Sender: TObject);begin i:=1;end;end.
 
谢了。发分了。
 

Similar threads

后退
顶部