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 ExpressBars menu system

Drop a TdxPrintStyleManager component on a form.

The ExpressBars Suite is used as your Menu/Toolbar system, if Advanced is assigned to the PreviewDialogStyle property of the currently active engine controller or dxPSEngine global object. This topic demonstrates how to populate a TdxBarPopupMenu with print styles available via the Print Preview dialog’s File | Page Setup sub menu.

Page Setup Menu

Assign the following code to the OnChangeCurrentStyle event handler (bliPrintStyles is a TdxBarListItem object):

var
  dxBarManager1: TdxBarManager;
  dxBarPopupMenu1: TdxBarPopupMenu;
//...
procedure TMyForm.dxPrintStyleManager1ChangeCurrentStyle(Sender: TObject)
begin
  bliPrintStyles.ItemIndex := dxPrintStyleManager1.CurrentStyleIndex;
end;

Assign the following code to the OnStyleListChanged event handler (bbDefinePrintStyles is a TdxBarButton object):

procedure TMyForm.dxPrintStyleManager1StyleListChanged(Sender: TObject)
begin
  dxComponentPrinter1.CurrentLink.BuildPageSetupMenu(bliPrintStyles, bbDefinePrintStyles, True);
end;