PDFiumVCL Docs

Anchors property

Dieser API-Eintrag behält Bezeichner, Signaturen, Codeblöcke und PDF-Begriffe in ihrer Originalform.
Component: TPdfView  ·  Unit: PDFium
Specifies which edges of the viewer remain a fixed distance from the corresponding edges of its parent when the parent is resized.

Syntax

property Anchors: TAnchors; // published, default [akLeft, akTop]

Description

Anchors are an alternative to Align that give pixel-accurate control over how the PDF viewer follows its parent container. Each element of the set (akLeft, akTop, akRight, akBottom) locks that edge of the viewer to the same edge of the parent — if both opposing edges are anchored, the viewer stretches when the parent resizes; if only one is anchored, the viewer keeps its size and slides.

The most common layout for a PDF reader inside a fixed-width inspector pane or a wizard step is [akLeft, akTop, akRight, akBottom], which is functionally equivalent to alClient but leaves the design-time bounding rectangle intact and lets you nest other controls around the viewer without z-order surprises.

Whenever an anchor causes the viewer to grow or shrink, the inherited resize handler recomputes the scrolling area; the active FitMode (when not pfmNone) is re-applied so the page artwork keeps its visual relationship with the viewport.

Remarks

Example

// Lock the viewer to all four edges of its parent panel
procedure TForm1.ConfigureViewer;
begin
  PdfView1.Parent := PanelMain;
  PdfView1.Align := alNone;
  PdfView1.SetBounds(8, 8, PanelMain.ClientWidth - 16,
    PanelMain.ClientHeight - 16);
  PdfView1.Anchors := [akLeft, akTop, akRight, akBottom];
  PdfView1.Constraints.MinWidth := 320;
  PdfView1.Constraints.MinHeight := 240;
end;

See Also

Align, Constraints, OnResize, FitMode