QurbanDurrani
asked on
'List Index out of bound(6)' with iterating through the components on a form.
The following code throws a 'List Index Out of bounds(6)' error. I am trying to change font for all the components on a form and any components within a component.(for example a form containing a pagecontrol which contains several tabsheets, which inturn contain several different components.)
What am I doing wrong?
procedure TSLCCOTForm.FormShow(Sende r: TObject);
begin
if PixelsPerInch <> 96 then
Iterate(SLCCOTForm);
end;
procedure TSLCCOTForm.Iterate(Contr: TWinControl);
var
i, DesiredSize : integer;
begin
for i := 0 to Contr.ControlCount -1 do
begin
DesiredSize := 8;
TFooClass(Controls[i]).Fon t.Name := 'Arial';
TFooClass(Controls[i]).Fon t.Size := MulDiv(DesiredSize,96,Pixe lsPerInch) ;
if Contr.Controls[i] is TWinControl then
Iterate(Contr.Controls[i] as TWinControl);
end;
end;
What am I doing wrong?
procedure TSLCCOTForm.FormShow(Sende
begin
if PixelsPerInch <> 96 then
Iterate(SLCCOTForm);
end;
procedure TSLCCOTForm.Iterate(Contr:
var
i, DesiredSize : integer;
begin
for i := 0 to Contr.ControlCount -1 do
begin
DesiredSize := 8;
TFooClass(Controls[i]).Fon
TFooClass(Controls[i]).Fon
if Contr.Controls[i] is TWinControl then
Iterate(Contr.Controls[i] as TWinControl);
end;
end;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER