PDFium Delphi Component Docs

CharacterIndexAtPos الطريقة

Component: TPdfView  ·  Unit: PDFium
يعيد فهرس الحرف في الصفحة الحالية الأقرب إلى بكسل الشاشة (X, Y)، أو -1 إذا لم يكن أي حرف قريبًا بما يكفي

Syntax

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

Description

يعيد فهرس الحرف في الصفحة الحالية الأقرب إلى بكسل الشاشة (X, Y)، أو -1 إذا لم يكن أي حرف قريبًا بما يكفي

استخدمها في OnMouseDown لبدء تحديد النص

يحتفظ TPdfView بتحويل الجهاز إلى الصفحة داخليًا استنادًا إلى Zoom و Rotation وحشو الصفحة وإزاحة التمرير؛ وهذه الموصلات هي الواجهة العامة الآمنة لذلك التحويل

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