Back to Devexpress

PrintingController.PrintingSettingsLoaded Event

expressappframework-devexpress-dot-expressapp-dot-win-dot-systemmodule-dot-printingcontroller-ea5eb778.md

latest4.8 KB
Original Source

PrintingController.PrintingSettingsLoaded Event

Occurs when the PrintingController.PrintAction is executed.

Namespace : DevExpress.ExpressApp.Win.SystemModule

Assembly : DevExpress.ExpressApp.Win.v25.2.dll

NuGet Packages : DevExpress.ExpressApp.Win, DevExpress.ExpressApp.Win.Design

Declaration

csharp
public event EventHandler<PrintableComponentLinkEventArgs> PrintingSettingsLoaded
vb
Public Event PrintingSettingsLoaded As EventHandler(Of PrintableComponentLinkEventArgs)

Event Data

The PrintingSettingsLoaded event's data class is DevExpress.ExpressApp.Win.SystemModule.PrintableComponentLinkEventArgs.

Remarks

The PrintingSettingsLoaded event is raised as the result of invoking the PrintingController.LoadPrintingSettings method. You can handle this event in a custom View Controller to customize the PrintableComponentLink, which represents a printing link to the printable control. In the handler, you can access the PrintableComponentLink object in the following manner:

csharp
using DevExpress.ExpressApp.Win.SystemModule;
// ...
public class ConfigurePrintingSettingsViewController : ViewController {
    private PrintingController printingService;
    protected override void OnActivated() {
        base.OnActivated();
        printingService = Frame.GetController<PrintingController>();
            if (printingService != null)
                printingService.PrintingSettingsLoaded += printingService_PrintingSettingsLoaded;
    }
    private void printingService_PrintingSettingsLoaded(
        object sender, PrintableComponentLinkEventArgs e) {
        e.PrintableComponentLink.PaperKind = System.Drawing.Printing.PaperKind.A4;
        e.PrintableComponentLink.Landscape = true;
    }
    protected override void OnDeactivated() {
        if (printingService != null)
            printingService.PrintingSettingsLoaded -= printingService_PrintingSettingsLoaded;
        base.OnDeactivating();
    }
}

The PrintableComponentLink object provides access to the PrintingSystem object using the PrintingSystem property. Refer to the How to: Customize Export Options of the Printing System, to see an example on how to access the Printing System in the PrintingSettingsLoaded event handler.

Note

The PrintingSettingsLoaded event is not raised when GridControl is used with a CollectionSource object in Server mode (see CollectionSourceBase.DataAccessMode), or when the PrintingController.CustomForceGridControlMethods event is handled and its Force parameter is set to true. In this case, you can customize the grid print preview options using the GridOptionsPrint object.

See Also

How to: Customize Export Options of the Printing System

CustomGetPrintableControl

PrintingController Class

PrintingController Members

DevExpress.ExpressApp.Win.SystemModule Namespace