PrintSettingsDialogFactory
The PrintSettingsDialogFactory property of RadScheduler allows you to replace the default print settings dialog with a custom one. The property accepts any object that implements the IPrintSettingsDialogFactory interface.
When the end user opens the print settings dialog (for example, through PrintPreview), RadScheduler calls the CreateDialog method of the assigned factory to obtain the dialog instance. If the property is not explicitly set, it defaults to an instance of SchedulerPrintSettingsDialogFactory, which creates the built-in SchedulerPrintSettingsDialog.
IPrintSettingsDialogFactory Interface
The IPrintSettingsDialogFactory interface defines a single method:
CreateDialog(RadPrintDocument document): Creates and returns aFormthat serves as the print settings dialog.
Creating a Custom Print Settings Dialog
To provide a custom print settings dialog, create a class that implements IPrintSettingsDialogFactory and assign it to the PrintSettingsDialogFactory property. The custom factory can return either a dialog that derives from the default SchedulerPrintSettingsDialog or an entirely new Form.
Deriving from the Default Dialog
Derive from SchedulerPrintSettingsDialog to modify the built-in form while keeping its existing layout and functionality.
public class MyCustomSchedulerPrintSettingsDialog : SchedulerPrintSettingsDialog
{
public MyCustomSchedulerPrintSettingsDialog(RadPrintDocument document)
: base(document)
{
// Customize the built-in dialog here.
}
}
public class CustomSchedulerPrintSettingsDialogFactory : IPrintSettingsDialogFactory
{
public Form CreateDialog(RadPrintDocument document)
{
return new MyCustomSchedulerPrintSettingsDialog(document);
}
}Creating a Dialog from Scratch
Return a new Form (or RadForm) to build a completely custom print settings dialog.
public class CustomSchedulerPrintSettingsDialogFactory : IPrintSettingsDialogFactory
{
public Form CreateDialog(RadPrintDocument document)
{
RadForm dialog = new RadForm();
dialog.Text = "Custom Print Settings";
// Build the dialog UI from scratch.
return dialog;
}
}Assigning the Custom Factory
this.radScheduler1.PrintSettingsDialogFactory = new CustomSchedulerPrintSettingsDialogFactory();After setting the factory, every subsequent call to PrintPreview uses the custom dialog.