Version

PageSetupDialogDisplaying Event

Occurs before the page setup dialog is displayed.
Syntax
'Declaration
 
Public Event PageSetupDialogDisplaying As PageSetupDialogDisplayingEventHandler
public event PageSetupDialogDisplayingEventHandler PageSetupDialogDisplaying
Event Data

The event handler receives an argument of type PageSetupDialogDisplayingEventArgs containing data related to this event. The following PageSetupDialogDisplayingEventArgs properties provide information specific to this event.

PropertyDescription
Cancel (Inherited from System.ComponentModel.CancelEventArgs) 
Dialog Read-only property that returns the PageSetupDialog that is about to be displayed.
Remarks

The PageSetupDialogDisplaying event is raised when the end-user has clicked the Page Setup button and allows you to alter the settings of the Dialog before it is displayed or even cancel the event and display your own custom page setup dialog.

Example
The following code gets called before the page setup dialog is displayed from the UltraPrintPreviewDialog.

For an overview of how to handle events in Visual Basic or Visual C#, see Event Handlers in Visual Basic and Visual C#. For specific information and code examples illustrating how to consume events in your application, see Consuming Events in the .NET Framework Developer's Guide.

Imports Infragistics.Win
Imports Infragistics.Win.Printing
Imports Infragistics.Win.UltraWinGrid
Imports Infragistics.Win.UltraWinScrollBar
Imports Infragistics.Win.UltraWinToolbars


    Private Sub ultraPrintPreviewDialog1_PageSetupDialogDisplaying(ByVal sender As System.Object, ByVal e As Infragistics.Win.Printing.PageSetupDialogDisplayingEventArgs) Handles ultraPrintPreviewDialog1.PageSetupDialogDisplaying

        ' cast the sender to a UltraPrintPreviewDialog
        Dim printPreviewDialog As UltraPrintPreviewDialog = CType(sender, UltraPrintPreviewDialog)

        ' set properties on the PageSetupDialog
        e.Dialog.AllowMargins = True

        '--------------------------------------------------------
        ' to display a custom setup dialog instead set the 
        ' Cancel property to true and display your dialog here
        ' e.g.
        ' e.Cancel = True
        '  
        ' ... show custom setup dialog modally here 
        '
        ' call InvalidatePreview on the UltraPrintPreviewDialog
        ' to cause the preview to be regenerated.
        '
        ' printPreviewDialog.InvalidatePreview()
        '--------------------------------------------------------

    End Sub
using Infragistics.Win;
using Infragistics.Win.Printing;
using Infragistics.Win.UltraWinGrid;
using Infragistics.Win.UltraWinScrollBar;
using Infragistics.Win.UltraWinToolbars;


		private void ultraPrintPreviewDialog1_PageSetupDialogDisplaying(object sender, Infragistics.Win.Printing.PageSetupDialogDisplayingEventArgs e)
		{
			// cast the sender to a UltraPrintPreviewDialog
			UltraPrintPreviewDialog printPreviewDialog = sender as UltraPrintPreviewDialog;

			// set properties on the PageSetupDialog
			e.Dialog.AllowMargins = true;

			//--------------------------------------------------------
			// to display a custom setup dialog instead set the 
			// Cancel property to true and display your dialog here
			// e.g.
			// e.Cancel = true;
			//
			// ... show custom setup dialog modally here 
			//
			// call InvalidatePreview on the UltraPrintPreviewDialog
			// to cause the preview to be regenerated.
			//
			// printPreviewDialog.InvalidatePreview();
			//--------------------------------------------------------

		}
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