for i:= 0 to Form1.ControlCount - 1 do
if(Form1.Controls[i].ClassName = 'TButton') then
(Form1.Controls[i] as TButton).Enabled:=false;好像if哪里一直得不到真.我form上有button阿
if(Form1.Controls[i].ClassName = 'TButton') then
(Form1.Controls[i] as TButton).Enabled:=false;好像if哪里一直得不到真.我form上有button阿
procedure TESCDispose.ClearText(AControl:TWinControl);
var
I: Integer;
begin
for I := 0 to AControl.ControlCount - 1 do // Iterate
begin
//需清空处理控件
if AControl.Controls[i] is TEdit then
begin
(AControl.Controls[i] as TEdit).Text:='';
end;
end;
end;//函数调用
procedure TESCDispose.MyKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
// ESC 键处理事件。
if (Key = VK_ESCAPE) then
begin
ClearText(self);
end;
end;
for i:= 0 to Self.ComponentCount - 1 do
if(Self.Components[i].ClassName = 'TButton') then
(Self.Components[i] as TButton).Enabled:=false;这样就可以遍历窗体上所有Button了
就象vc那样。