Skip to main content

How to: Print a Chart and Show its Print Preview

  • 2 minutes to read

This example demonstrates how to print a ChartControl, or show its Print Preview.

To do this, you should use either the ChartControlBase.Print or ChartControlBase.ShowPrintPreview methods.

The Print Preview displays the chart as it will appear when printed. Note that the chart can be previewed and printed only if the DXPrinting Library is available.

The image below shows the print preview of a Chart control.

ChartPrintPreview

Imports Microsoft.VisualBasic
Imports System.Windows

Namespace PrintChart

    Partial Public Class Window1
        Inherits Window
        Public Sub New()
            InitializeComponent()
        End Sub

        Private Sub button_ShowPrintPreview(ByVal sender As Object, ByVal e As RoutedEventArgs)
            chartControl1.ShowPrintPreview(Me)
        End Sub

        Private Sub button_Print_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
            chartControl1.Print()
        End Sub
    End Class
End Namespace