How to: Print a Scheduler and Show its Print Preview

  • 2 minutes to read

This example demonstrates the built-in print functionality of the SchedulerControl. To print the SchedulerControl, use either the SchedulerControl.Print or SchedulerControl.ShowPrintPreview methods.

NOTE

The SchedulerControl can be printed and previewed only if the XtraPrinting Library is available. To verify that printing the scheduler is possible, use the SchedulerControl.IsPrintingAvailable property.

To modify print settings, use the SchedulerControl.OptionsPrint property. End-users can specify printer settings in the Page Setup Dialog invoked by calling the SchedulerControl.ShowPrintOptionsForm method.

using DevExpress.XtraScheduler;
// ...

private void ShowSchedulerPreview(SchedulerControl scheduler) {
    // Check whether the SchedulerControl can be previewed.
    if(!scheduler.IsPrintingAvailable) {
        MessageBox.Show("The 'DevExpress.XtraPrinting.vX.Y.dll' is not found", "Error");
        return;
    }

    // Open the Preview window.
    scheduler.ShowPrintPreview();
}

private void PrintScheduler(SchedulerControl scheduler) {
    // Check whether the SchedulerControl can be printed.
    if(!scheduler.IsPrintingAvailable) {
        MessageBox.Show("The 'DevExpress.XtraPrinting.vX.Y.dll' is not found", "Error");
        return;
    }

    // Print.
    scheduler.Print();
}

The image below shows the print preview of a SchedulerControl.

SchedulerPrint