Hi,
am sichersten sollte es über
RTTI gehen:
Delphi-Quellcode:
Uses
TypInfo
...
procedure SetControlParams(AControl: TControl; AFontStyle: TFontStyles; w:
Integer = -1; h: Integer = -1; l: Integer = -1; t: Integer = -1);
Var
AFont: TFont;
begin
if w > -1 then AControl.Width:=w;
if h > -1 then AControl.Height:=h;
if l > -1 then AControl.Left:=l;
if t > -1 then AControl.Top:=t;
if IsPublishedProp(AControl, 'Font') then
begin
AFont := TFont(GetObjectProp(AControl, 'Font'));
AFont.Style := AFontStyle;
end;
end;