首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

操作窗体上所有控件,该怎么处理

2012-04-07 
操作窗体上所有控件如何让窗体上Tag1控件的控件Enabled : falseTag2控件的控件ReadOnly : true[解决办

操作窗体上所有控件
如何让窗体上Tag=1控件的控件Enabled := false
  Tag=2控件的控件ReadOnly := true

[解决办法]

Delphi(Pascal) code
procedure TForm2.Button1Click(Sender: TObject);var  I: Integer;begin  for I := 0 to self.ComponentCount - 1 do    begin      case self.Components[I].Tag of        1:          begin            if self.Components[I] is TControl then              TControl(self.Components[I]).Enabled:=false;          end;        2:          begin            if self.Components[I] is TControl then              TControl(self.Components[I]).Enabled:=True;          end;      end;    end;end; 

热点排行