Version

PrintPreview(UltraGridLayout,PrintDocument,RowPropertyCategories) Method

Initiates the creation of a preview of what a printed report of the grid data would look like.
Syntax
'Declaration
 
Public Overloads Sub PrintPreview( _
   ByVal layout As UltraGridLayout, _
   ByVal printDocument As PrintDocument, _
   ByVal retainRowPropertyCategories As RowPropertyCategories _
) 

Parameters

layout
Optional layout object
printDocument
Optional print document
retainRowPropertyCategories
Sepcifies which categories of the settings on the rows to apply to rows printed on the grid.
Remarks

The PrintPreview method initiates a print preview. Invoking this method triggers the process of preparing a printed report based on the data in the grid and displaying the results in a print preview window. This process has several steps and involves interaction between print-preview-specific objects and events within the control.

When you invoke this method, you specify a Layout object that controls the formatting of how the grid data will look when printed, and also while being previewed. The Layout object gives you the opportunity to create a custom-formated report based on the data in teh grid, applying different attributes such as fonts, colors and arrangement of data specifically for the printed page.

When the print preview begins, the InitializePrintPreview event occurs. This event receives a PrintDocument object that contains information about the print job being previewed. You examine and change the properties of this object to provide feedback for the user and control the look of the printed output. Any settings you have applied to the PrintDocument object specified as a paramter of the PrintPreview method will be passed along to the PrintDocument that appears in the InitializePrintPreview method.

Example
Following code shows how to show the print preview of the grid and how to print the grid. It demonstrates the use of RowPropertyCategories enum.

Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid

    Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button1.Click
        ' Pass in All to specify that all settings get carried over from grid rows
        ' to the print/print-preview rows. This is used to facilitate WYSIWYG printing.
        Me.UltraGrid1.PrintPreview(RowPropertyCategories.All)

        ' Call print to actually print.
        Me.UltraGrid1.Print(RowPropertyCategories.All)
    End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;

		private void button1_Click(object sender, System.EventArgs e)
		{
			// Pass in All to specify that all settings get carried over from grid rows
			// to the print/print-preview rows. This is used to facilitate WYSIWYG printing.
			this.ultraGrid1.PrintPreview( RowPropertyCategories.All );
			
			// Call print to actually print.
			this.ultraGrid1.Print( RowPropertyCategories.All );
		}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also