PDFium Delphi Component Docs

CharacterIndexAtPos メソッド

コンポーネント: TPdfView  ·  ユニット: PDFium
screen pixel (X, Y) に最も近い current page の character index を返します。近い character がなければ -1 です

Syntax

function CharacterIndexAtPos(X, Y: Integer; ToleranceX, ToleranceY: Double): Integer;

Description

screen pixel (X, Y) に最も近い current page の character index を返します。近い character がなければ -1 です

OnMouseDown でテキスト選択を始めるときに使います

TPdfView は Zoom、Rotation、ページパディング、スクロールオフセットに基づく device-to-page 変換を内部に維持しており、これらのヘルパーがその変換への安全な公開インターフェースです

Remarks

Example

procedure TForm1.PdfView1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
  PageX, PageY: Double;
begin
  if PdfView1.CharacterIndexAtPos(X, Y, PageX, PageY) then
    Caption := Format('pt = (%.2f, %.2f)', [PageX, PageY]);
end;

See Also

DeviceToPage, CurrentCharIndex, CharacterCount