想编写一个过程EnabledControl.调用时:
EnabledControl(MyButton,true); <--这样会把MyButton这个TButton的Enabled设为true.EnabledControl(MyMenu,false); <--这样会把MyMenu这个TMenuItem的Enabled设为false.EnabledControl(MyToolButton,true); <--这样会把MyToolButton这个TToolButton的Enabled设为true编写这过程不允许有if 和case等条件判断语句.
EnabledControl(MyButton,true); <--这样会把MyButton这个TButton的Enabled设为true.EnabledControl(MyMenu,false); <--这样会把MyMenu这个TMenuItem的Enabled设为false.EnabledControl(MyToolButton,true); <--这样会把MyToolButton这个TToolButton的Enabled设为true编写这过程不允许有if 和case等条件判断语句.
begin
(Sender as TControl).Enabled := Flag;
end;procedure TForm1.Button1Click(Sender: TObject);
begin
EnabledControl(Button1,False);
end;
begin
EnabledControl(Edit1,False);
end;