I need to change the FONT property of controls collected via the Controls
property of a container control:
for i := 0 to ContainerControl.ControlCount - 1 do
begin
ContainerControl.Controls[i].Font.Size := 8; // error
end;
For this, I would need to typecast ContainerControl.Controls[i]
to a class of TWinControl having a FONT property. Is there such a class? Or how can I detect whether a specific TWinControl has a FONT property? Or how cany I typecast a specific TWincontrol to the type of a specific other TWinControl?
Every TControl has a Font property, it's just protected. So you can use the usual cast trick:
type
TControlAccess = class(TControl);
TControlAccess(MyControl).Font.Size := 10;