PDFiumVCL 文件

HighlightColor property

此 API 條目保留識別符號、簽名、程式碼塊和 PDF 術語的原始形式。
Component: TPdfView  ·  Unit: PDFium
Colour of the rectangle painted over each match returned by HighlightSearchText. Defaults to clYellow; published so applications can theme the highlight.

Syntax

property HighlightColor: TColor;

Description

HighlightColor is the brush colour the view uses when painting the search-result mask over every match found by HighlightSearchText. The mask is overlaid on each redraw, on top of the rendered PDF page, so the highlight visibly tracks scrolling and zoom without re-running the search.

The default value is clYellow — the convention every mainstream PDF reader uses for find-in-page highlights. The property is published so applications can theme the colour to match their UI palette without subclassing TPdfView (a deep amber for a sepia reader theme; a soft cyan for a dark-mode viewer).

HighlightColor is the only styling knob for the overlay — the mask is a flat colour fill behind the text, intentionally simple so that highlight rectangles never obscure glyph anti- aliasing. For multi-coloured highlights (different colours per match / per query / per page), use a custom OnPaint handler instead of HighlightSearchText.

Remarks

Example

// Theme the highlight to match a dark reader UI
PdfView1.HighlightColor := $00FFFF66; // pale yellow
PdfView1.HighlightSearchText('invoice', False, True);

// Round-trip via the Object Inspector default
PdfView1.HighlightColor := clYellow;

See Also

HighlightSearchText, ClearHighlight, FindFirst