Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

Using the BuildPageSetupMenu method with the standard Delphi menu system

Standard Delphi menu system is used in the Print Preview dialog when Standard is assigned to the PreviewDialogStyle property of the currently active engine controller or dxPSEngine global object. This topic demonstrates how to populate a TPopupMenu with print styles available via the Print Preview dialog’s File | Print Styles sub menu.

Page Setup Menu

Drop a TdxPrintStyleManager component on a form.

Assign the following code to the OnChangeCurrentStyle event handler:

var
  PopupMenu: TPopupMenu;
//...
procedure TMyForm.dxPrintStyleManager1ChangeCurrentStyle(Sender: TObject)
var
  I: Integer;
begin
  for I := 0; to PopupMenu.Items.Count - 1 do
    PopupMenu.Items[I].Checked := TBasedxPrintStyle(PopupMenu.Items[I].Tag) = dxPrintStyleManager1.CurrentStyle;
end;

Assign the following code to the OnStyleListChanged event handler:

procedure TMyForm.dxPrintStyleManager1StyleListChanged(Sender: TObject)
begin
  PopupMenu.Items.Clear;
  dxComponentPrinter1.CurrentLink.BuildPageSetupMenu(PopupMenu.Items, nil, True);
end;