Link.ShowPreview() Method

Invokes the Print Preview Form which shows the print preview of the document for this link.

Namespace: DevExpress.XtraPrinting

Assembly: DevExpress.XtraPrinting.v20.2.dll

Declaration

public virtual void ShowPreview()
Public Overridable Sub ShowPreview

Remarks

Use the ShowPreview method to invoke the PrintPreviewFormEx form and show the print preview of the document created for this link. Note that if the link's document hasn't been created (the Link.CreateDocument method hasn't been called for it), then calling the ShowPreview will create it first. Consequently, if a document was created prior to calling the ShowPreview method, and nothing was changed that may force its re-creation, the ShowPreview method doesn't re-create it, so you need to manually call the Link.CreateDocument method, if required.

The image below displays the standard Print Preview form.

PrintPreviewFormEx.png

Examples

The following code demonstrates how to create a PrintableComponentLink, add it to the PrintingSystem.Links collection, adjust its printing settings, and use it to print an existing GridControl.

using DevExpress.XtraPrinting;
using DevExpress.XtraGrid.Views.Grid;
// ...

// Create printing components.
PrintingSystem printingSystem1 = new PrintingSystem();
PrintableComponentLink printableComponentLink1 = new PrintableComponentLink();
// ...

private void Form1_Load(object sender, EventArgs e) {
    // Add the link to the printing system's collection of links.
    printingSystem1.Links.AddRange(new object[] { printableComponentLink1 });

    // Assign a control to be printed by this link.
    printableComponentLink1.Component = gridControl1;

    // Assign the printing system to the document viewer.
    documentViewer1.PrintingSystem = printingSystem1;
}

Implements

DevExpress.XtraPrinting.Links.IWinLink.ShowPreview()
See Also