uses kısmına typinfo unitini ekleyin.
procedure TForm1.SetReadOnly( Value : boolean ) ;
var
PropInfo : PPropInfo ;
Component : TComponent ;
i : integer ;
begin
for i := 0 to ComponentCount - 1 do begin
Component := Components[ i ] ;
if Component is TControl then begin
PropInfo := GetPropInfo( Component.ClassInfo, 'ReadOnly' ) ;
if Assigned( PropInfo ) and
( PropInfo^.PropType^.Kind = tkEnumeration ) then
SetOrdProp( Component, PropInfo, integer( Value ) ) ;
end ;
end ;
end ;
procedure TForm1.Button1Click(Sender: TObject);
begin
SetReadOnly( true ) ;
end;