Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

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