ChartControl.ShowPrintPreview() Method
Invokes the Print Preview Form, which shows the print preview of the chart.
Namespace: DevExpress.XtraCharts
Assembly: DevExpress.XtraCharts.v24.2.UI.dll
NuGet Package: DevExpress.Win.Charts
#Declaration
#Remarks
The Print Preview form displays the chart as it will appear when printed. To print the chart, use the ChartControl.Print method and to export it, use the appropriate ExportTo~ method (e.g. ChartControl.ExportToHtml, ChartControl.ExportToPdf, etc.)
Note
The chart can be previewed, printed or exported only if the Xtra
#Example
The following example demonstrates how to print a ChartControl, or show its Print Preview. To do this, you should use either the ChartControl.Print or ChartControl.ShowPrintPreview methods.
Note
A chart can be printed and previewed only if the Xtra
When printing a chart, the current print settings will be used to represent a chart. Note that you can access and change these settings via the ChartControl.OptionsPrint property. End-users manually select the printer settings by clicking the Customize toolbar button () in a chart’s preview, and setting the required options in the Printable Component Editor.
using DevExpress.XtraCharts;
// ...
private void ShowChartPreview(ChartControl chart) {
// Check whether the ChartControl can be previewed.
if (!chart.IsPrintingAvailable) {
MessageBox.Show("The 'DevExpress.XtraPrinting.v7.2.dll' is not found", "Error");
return;
}
// Open the Preview window.
chart.ShowPrintPreview();
}
private void PrintChart(ChartControl chart) {
// Check whether the ChartControl can be printed.
if (!chart.IsPrintingAvailable) {
MessageBox.Show("The 'DevExpress.XtraPrinting.v7.2.dll' is not found", "Error");
return;
}
// Print.
chart.Print();
}