ungetestet sowas in der Art?
Delphi-Quellcode:
procedure TRSPdfFrame.PdfViewCreate;
var i: integer;
myCompo : TComponent;
begin
for i := 0 to 4 do
begin
myCompo := ScrollBox1.FindComponent('PdfView'+intToStr(i));
if not Assigned(myCompo) then
begin
FPDFView := TPdfView.Create(Self);
FPdfView.Parent := Scrollbox1;
FPdfView.Name := 'PdfView'+intToStr(i);
FPdfView.Color := clyellow;
end
else
begin
FPdfView := TPdfView(myCompo);
end;
FPdfView.Height := 120;
FPdfView.Top := i * (FPdfView.Height + 8);
FPdfView.Width := Scrollbox1.ClientWidth - 40;
FPdfView.Left := (ScrollBox1.ClientWidth - FPdfView.Width) div 2;
ScrollBox1.VertScrollBar.Range := ScrollBox1.VertScrollBar.Range + FPdfView.Height;
end;
end;