windowsforms-devexpress-dot-xtracharts-dot-chartcontrol-56a49174.md
Allows you to customize print and export options before the chart is printed or exported.
Namespace : DevExpress.XtraCharts
Assembly : DevExpress.XtraCharts.v25.2.UI.dll
NuGet Package : DevExpress.Win.Charts
public event ChartPrintInitializeEventHandler PrintInitialize
Public Event PrintInitialize As ChartPrintInitializeEventHandler
The PrintInitialize event's data class is ChartPrintInitializeEventArgs. The following properties provide information specific to this event:
| Property | Description |
|---|---|
| Link | Gets a PrintableComponentLinkBase object that provides the general functionality to print the Chart Control. |
| PrintingSystem | Returns the Printing System used to create and print a document for the link associated with the Chart Control. |
You can preview, print and export the chart if the Printing-Exporting library is available and the DevExpress.XtraPrinting.25.2 and DevExpress.Printing.v25.2.Core assemblies are added to the project.
The following code shows how to use the ChartControl.PrintInitialize event to configure the chart’s print options before the chart is previewed.
using DevExpress.XtraPrinting;
//...
chartControl.PrintInitialize += chartControl_PrintInitialize;
private void chartControl_PrintInitialize(object sender, DevExpress.XtraCharts.ChartPrintInitializeEventArgs e) {
PrintingSystemBase printingSystem = e.PrintingSystem as PrintingSystemBase;
printingSystem.PageSettings.Landscape = true;
}
// Preview the chart in the landscape orientation.
chartControl.ShowPrintPreview();
Imports DevExpress.XtraPrinting
'...
chartControl.PrintInitialize = (chartControl.PrintInitialize + chartControl_PrintInitialize)
Private Sub chartControl_PrintInitialize(ByVal sender As Object, ByVal e As DevExpress.XtraCharts.ChartPrintInitializeEventArgs)
Dim printingSystem As PrintingSystemBase = CType(e.PrintingSystem,PrintingSystemBase)
printingSystem.PageSettings.Landscape = true
End Sub
' Preview the chart in the landscape orientation.
chartControl.ShowPrintPreview
See Also