Back to Devexpress

ChartPrinter Class

corelibraries-devexpress-dot-xtracharts-dot-printing-b44da284.md

latest2.8 KB
Original Source

ChartPrinter Class

Represents the facility for chart printing.

Namespace : DevExpress.XtraCharts.Printing

Assembly : DevExpress.XtraCharts.v25.2.dll

NuGet Package : DevExpress.Charts

Declaration

csharp
[RuntimeObject]
public class ChartPrinter :
    IChartPrinter,
    IDisposable,
    ICloneable
vb
<RuntimeObject>
Public Class ChartPrinter
    Implements IChartPrinter,
               IDisposable,
               ICloneable

Remarks

Use the ChartPrinter class, to specify your chart’s print settings, and then pass them to the PrintingSystem component.

Example

This example demonstrates how to specify the printing settings of a chart (to fit its size to the page width), using the ChartPrinter class.

csharp
using System;
using System.Windows.Forms;
using DevExpress.XtraPrinting;
using DevExpress.XtraCharts.Printing;
// ...

ChartPrinter cp;

private void button1_Click(object sender, EventArgs e) {
    Link l = new Link(new PrintingSystem());
    l.Landscape = true;
    l.PaperKind = System.Drawing.Printing.PaperKind.A3;
    cp = new ChartPrinter(this.chartControl1);
    cp.Initialize(l.PrintingSystem, l);
    cp.SizeMode = PrintSizeMode.Stretch;
    l.CreateDetailArea += new CreateAreaEventHandler(l_CreateDetailArea);
    l.ShowPreviewDialog();
    cp.Release();
}

void l_CreateDetailArea(object sender, CreateAreaEventArgs e) {
    cp.CreateDetail(e.Graph);
}
vb
Imports System
Imports System.Windows.Forms
Imports DevExpress.XtraPrinting
Imports DevExpress.XtraCharts.Printing
' ...
Private cp As ChartPrinter

Private Sub button1_Click(ByVal sender As Object, _ 
ByVal e As EventArgs) Handles button1.Click
    Dim l As New Link(New PrintingSystem())
    l.Landscape = True
    l.PaperKind = System.Drawing.Printing.PaperKind.A3
    cp = New ChartPrinter(Me.chartControl1)
    cp.Initialize(l.PrintingSystem, l)
    cp.SizeMode = PrintSizeMode.Stretch
    AddHandler l.CreateDetailArea, AddressOf l_CreateDetailArea
    l.ShowPreviewDialog()
    cp.Release()
End Sub

Private Sub l_CreateDetailArea(ByVal sender As Object, _ 
ByVal e As CreateAreaEventArgs)
    cp.CreateDetail(e.Graph)
End Sub

Inheritance

Object ChartPrinter

See Also

ChartPrinter Members

DevExpress.XtraCharts.Printing Namespace