if en=true then
      cl:=clWindow
      else
      cl:=clScrollBar;  for I:=0 to Panel2.ControlCount  - 1  do
   begin
   Temp:= Panel2.Controls[i];
      if temp is TDBEdit then
        (temp as TDBEdit).Color:=cl;
   end;

解决方案 »

  1.   

    (temp as TDBEdit).Enabled:=false;
      

  2.   

    for I:=0 to panel2.ControlCount  - 1  do
       begin
       Temp:= panel2.Controls[i];
          if temp is TDBEdit then
            if (temp as TDBEdit).Enabled = false then
               (temp as TDBEdit).Color:=clScrollBar
               else
               (temp as TDBEdit).Color:=clWindow;
          if temp is TRadiobutton then
            if (temp as TRadiobutton).Enabled = false then
               (temp as TRadiobutton).Color:=clScrollBar
               else
               (temp as TRadiobutton).Color:=clWindow;
          if temp is TDBCombobox then
            if (temp as TDBCombobox).Enabled = false then
               (temp as TDBCombobox).Color:=clScrollBar
               else
               (temp as TDBCombobox).Color:=clWindow;
       end;