以下的东西我试了,在我这里可以。(别忘了加上单元QComCtrls)
假设使用一个button来创建控件。
现在窗体上放一个progressbar控件,这样会自动声明progressbar1:TProgressBar;
然后在 TForm1.Button1Click里写上
var
progressbar1:TProgressBar;
begin
progressbar1:=TProgressBar.Create(self);
with progressbar1 do
begin
progressbar1.parent:=self;
progressbar1.align:=alBottom;
end;
end;
然后将刚才自己放上的那个progressbar删除。编译一下试试,应当就可以了,如果不行,权当灌水了:)
var
progressbar:TProgressBar;
begin
progressbar:=TProgressBar.Create(self);
with progressbar do
begin
parent:=self;
align:=alBottom;
end;
end;
别人告我这么写,告完就消失了!!!!!!!!!!!
uses
necesaryunit;
////////////////
if you do not know which unit to use,open "delphi help" and type the class you are using for instance "TProgressbar",then you will know everything.