Skip to main content

TCustomdxComponentPrinter PreviewOptions and PreviewWindow Example

In most cases, setting the preview form properties via a component printer’s PreviewOptions or PreviewWindowForm property is equivalent. The following code sets position, size and icon of a preview from via PreviewOptions and PreviewWindowForm properties:

// Uses the PreviewOptions property
procedure TForm1.Button1Click(Sender: TObject);
begin
 . . .
  with dxComponentPrinter1.PreviewOptions do
  begin
    Left := 10;
    Width := 200;
    Height := 200;
    Top := 10;
'c:\pvIcon.ico'
  end;
. . .
end;
// Uses the PreviewWindowForm property
// This procedure is an event handler of the
// component printer's OnBeforePreview event
procedure TForm1.dxComponentPrinter1BeforePreview(Sender: TObject);
begin
. . .
  with dxComponentPrinter1.PreviewWindowForm do
  begin
    Left := 10;
    Width := 200;
    Height := 200;
    Top := 10;
'c:\pvIcon.ico'
  end;
. . .
end;