现在的位置: 首页 > 综合 > 正文

把窗体中所有的Button的Enabled置为False

2013年12月09日 ⁄ 综合 ⁄ 共 413字 ⁄ 字号 评论关闭
把窗体中所有的Button的Enabled置为False

procedure TForm1.FormCreate(Sender: TObject);
var index:integer;
begin
For Index:=0 to ControlCount-1 do
 if Components[Index] is TButton then
  begin
   (Components[Index] As TButton).enabled:=False;
  end;
end;
end.
 
//设置窗体中所有Button的Enabled为False
procedure TForm2.Button3Click(Sender: TObject);
var 
i:integer;
begin
for i:=0 to self.ControlCount-1 do 
 if self.Controls[i] is TButton then 
   TButton(self.Controls[i]).Enabled:=False;
end;


抱歉!评论已关闭.