TPopupMenu bir PDF görüntüleyicisiyle birlikte kullanın; böylece bir sayfaya sağ tıklamak bağlam menüsü gösterir.property PopupMenu: TPopupMenu; // published, inherited from TControl
PopupMenu atamak, görüntüleyiciyi aynı form üzerindeki bir TPopupMenu component'ine bağlar. Kullanıcı görüntüleyici içinde sağ tıkladığında (veya klavye menü tuşuna bastığında) VCL/LCL menüyü otomatik olarak imleç konumunda gösterir — uygulamanın WM_CONTEXTMENU'yu kendisinin işlemesi gerekmez
A typical PDF reader context menu offers items such as Copy Selected Text, Zoom In, Zoom Out, Fit Width, Rotate, Go to Page…, Find… and Save As…. The menu items typically read or write public properties such as CurrentCharIndex, Zoom, FitMode, Rotation and PageNumber to act on the document.
Because the popup is displayed via the OnContextPopup mechanism, you can suppress or replace it dynamically by handling OnContextPopup and setting Handled := True — useful when the right-click occurs over a form field or annotation that needs its own menu.
TPopupMenu örneğine olan bağ, form dosyasında bir component referansı olarak saklanırAllowUserTextSelection False iken bile açılırTPopupMenu.OnPopup and inspect viewer state such as CurrentCharIndex or Pdf.Active.
// Attach a context menu offering Copy / Fit Width / Go to Page
procedure TForm1.FormCreate(Sender: TObject);
begin
PdfView1.PopupMenu := pmReader;
end;
procedure TForm1.miFitWidthClick(Sender: TObject);
begin
PdfView1.FitMode := pfmFitToWidth;
end;
procedure TForm1.miGoToPageClick(Sender: TObject);
var S: string;
begin
S := IntToStr(PdfView1.PageNumber);
if InputQuery('Go to page', 'Page number:', S) then
PdfView1.PageNumber := StrToIntDef(S, PdfView1.PageNumber);
end;