Thanks for the docs reference. I added this code below, which seems to work if any others are interested:
procedure TMyForm.Print(printSettingsFilePath: WideString);
begin
if ImageEnVect1.IO.Params.ImageCount > 1 then begin
if FileExists( printSettingsFilePath ) then begin
ImageEnMView1.MIO.PrintPreviewParams.LoadFromFile(printSettingsFilePath);
end;
ImageEnMView1.MIO.DoPrintPreviewDialog;
ImageEnMView1.MIO.PrintPreviewParams.SaveToFile(printSettingsFilePath);
end else begin
if FileExists( printSettingsFilePath ) then begin
ImageEnVect1.IO.PrintPreviewParams.LoadFromFile(printSettingsFilePath);
end;
ImageEnVect1.IO.DoPrintPreviewDialog(iedtDialog);
ImageEnVect1.IO.PrintPreviewParams.SaveToFile(printSettingsFilePath);
end;
end;
procedure TMyForm.ImageEnVect1ShowDialog(Sender: TObject;
DlgType: TIEDlgType; Form: TForm);
begin
if DlgType = iefPrintPreview then begin
with TfiePrnForm2(Form) do
begin
// Create Reset button so users can reset the form values
with TButton.Create( Form ) do
begin
Parent := Form;
Left := btnSetup.Left + btnSetup.Width + {add same spacing as between OK and Cancel buttons} (btnCancel.Left - (btnOK.Left + btnOK.Width));
Top := btnSetup.Top;
Width := btnCancel.Width;
Height := btnSetup.Height;
Anchors := [akBottom, akLeft];
Caption := iemsg(IEMSG_RESET); // Use ImageEn's localized string
OnClick := PrintResetClicked;
end;
end;
end else if DlgType = iefMultiPrintPreview then begin
// TODO: Not sure where to put Reset button in layout yet
end;
end;
procedure TMyForm.PrintResetClicked(Sender: TObject);
begin
// Create a blank new version of TIOPrintPreviewParams with defaults
FreeAndNil(TfiePrnForm2(TButton(Sender).Parent).fPrintPreviewParams); // free existing params so we can initialize new ones
TfiePrnForm2(TButton(Sender).Parent).fPrintPreviewParams := TIOPrintPreviewParams.Create; // the Create constructor initializes defaults
// Load the paramters into the print form
TfiePrnForm2(TButton(Sender).Parent).LoadParameters;
// Refresh the remaining items on the form -- TfiePrnForm2 (ieprnform2.pas) calls PrintPreview at the end of FormActivate to set the state of the window, so we repeat that here
TfiePrnForm2(TButton(Sender).Parent).PrintPreview(nil);
end;