وثائق PDFiumVCL

OnDblClick event

يحافظ إدخال API هذا على المعرّفات والتواقيع وكتل الكود ومصطلحات PDF بصيغتها الأصلية.
Component: TPdfView  ·  Unit: PDFium
Occurs when the user double-clicks (left mouse button) inside the viewer.

Syntax

property OnDblClick: TNotifyEvent; // published, inherited from TControl

Description

OnDblClick fires after the second OnClick in a double-click sequence, using the system double-click time and pixel slop window. The Sender parameter is the TPdfView itself; the screen location can be retrieved from Mouse.CursorPos and converted to client coordinates with ScreenToClient.

A natural use for this event in a PDF reader is the "zoom-to-point" gesture: the user double-clicks the document to toggle between fit-to-width and the previous zoom level, optionally centering the view on the click position. Another common pattern is to use double-click to select the word under the cursor by calling CharacterIndexAtPos and then expanding CurrentCharIndex / selection length around the hit character.

The viewer's annotation/link handler runs first — if the user double-clicks a link, the first click already followed the link. Double-click is therefore best reserved for behaviour that does not conflict with normal navigation gestures.

Remarks

Example

// Toggle between fit-to-width and 100% zoom on double-click
procedure TForm1.PdfView1DblClick(Sender: TObject);
begin
  if PdfView1.FitMode = pfmFitToWidth then
  begin
    PdfView1.FitMode := pfmNone;
    PdfView1.Zoom := 1.0;
  end
  else
    PdfView1.FitMode := pfmFitToWidth;
end;

See Also

OnClick, FitMode, Zoom, CharacterIndexAtPos